Planet CDOT

September 22, 2019


Carlos A. Gomez

Of icons and open source

I had this strange thougth lately about customization of android and open source.

why? because there really isnt a a good way to make your own set. looking at customization tools, there is code readely available-if im honest if it was in a github to be exported I may feel a bit better about it-alas if it is , its probably obscure

this is a topic that came up upon learning of the customization tools in launchers, in android an other branches of the android system, the now defunct cyanogenmod, -and its spiritual succesor lineage- have this ffeature and if you ask if there is such a thing as apetite for customization, recently samsung released a smart case with icons, and theme of spiderman, but only if you buy the case.

Im two minds about this, I believe creators absolutely deserve to be paid, but im againts exclusivity I would love to have that theme for example. but once again under the paywall of exlusivity stops me from obtaining such customization.

whats the point you are probably asking, Im arguing that we are pretty much ignoring a side of android that could be much greater, the idea of just customizing your icons is powerful- I remember on the early 2000 themes for windows 98 and 2000 were all the rage. We lost that spark come xp despite excellent themeing software being available. true in the end this comes to money but i think there is a posibility here to create a structured aproach for all of us to make customizations to android. if not a suit a repository to clone where to start, with basic icons we can click change, etc before making an apk that can be suported, in fact while I want this to be open, im not againts the idea of artist having a framework to be able to enter a market place that while crowded, is full of posibilites we havent exploited. there is appetite, and sincerely what we need is an entry point, and i think open source can be the beggining of this.

by cagomezr at September 22, 2019 03:01 AM


Brett Dennis

A Microcosm of Open Source

In the last bit of time, I have been working in a small community of aspiring open source developers as we all learn the basics of contributing to open sourced projects in a smaller closed environment so that we might learn how to properly approach the problems and situations we may find ourselves encountering on a daily basis in the real environment.

We had all made similar projects to each other, and were tasked with finding two things within the projects of our peers: An improvement or bug fix we wish to make upon another project, as well as an addition of new functionality to another unrelated project. This would in turn, teach us about branches and how to work with them, pull requests, issues, and the overall workflow of contributing to an open source project, still within the safety of a closed environment for the time being.

Personally, I had found a conflict of key binds. A key bind used in a project of a peer of mine would perform two similar but different actions. The CTRL+S key bind is usually used to save items or documents, or even in the case of web browsers, entire pages. Naturally, it makes sense to use this key bind, but in this situation, using this key bind would both save the document, but also open up the save dialogue for the browser, potentially confusing any user who does not know that these may be entirely separate processes. They may be confused as to what the application is asking of them and may think they have saved incorrectly despite the popup window being unrelated to the application at hand. I had filed an issue for this and made a pull request that intercepts the event call to the browser key bind, ensuring the applications key bind is the only one that gets called, removing any and all doubt from a potential users mind. The issue and pull requests can be reviewed here:
Issue and Pull Request

The other project I worked on was the implementation of PaperCSS onto a note program to make the program look like it was being written on paper, as well as centering the program. I had figured the theming of it being a note program would work well with the stylistic additions of PaperCSS and worked upon implementing it by filing an enhancement addition to this project and opening a pull request from one of my forked branches to add this functionality to the project. I was given the go ahead from the repository owner, and started working on it. Those issues and pull requests can be found here:

Issue and Pull Request

As it was a community based experiment, that means I was also given the opportunity to see what it is like on the owner’s side of the PR. The requests come in unexpectedly, and the reviews are a major part of ensuring your repository gets held up to your standards. Luckily, GitHub’s diff tools and other great additions by the GitHub community make it easier to look through all the changes made by the contributors to your repository. In my case, I have had contributors who wanted to add enhancements to my code, who opened up their own PR’s. I then looked using the diff tools and ran their own branches to ensure all the code was working properly, made the appropriate comments, and merged the branches.

Those can be seen here and here.

I also engaged in a bit of discussion on certain java script features while explaining my own contributions, as seen here.

This small microcosm of an open source development style is incredibly helpful and teaches foundations of how to work in Open Source. There is quite a bit more to learn, but this is a good start.

by ultimabgd at September 22, 2019 12:23 AM

September 21, 2019


Bowei Yao

Filing issues and creating PRs

According to the requirements of our assignment release 0.1, we are to file 2 separate issues on 2 different repositories written by fellow classmates. One of them must be a bug fix, and the other one must be a new feature.

Here are the links to the issues which I have created:

bug fix:

issue: https://github.com/SiwenFeng/whiteboard/issues/2

PR: https://github.com/SiwenFeng/whiteboard/pull/3

new feature:

issue: https://github.com/UltimaBGD/micro-note/issues/2

PR: https://github.com/UltimaBGD/micro-note/pull/3

In addition, I have received issues being filed on my own repository, as well as its corresponding pull request. I will be doing the code review soon, and if all is well, it will be promptly merged into the master branch.

issues filed on my own repository:

issue: https://github.com/ragnarokatz/my-note/issues/1

PR: https://github.com/ragnarokatz/my-note/pull/2

One of the major functionalities of github is the capabilities of enabling people who have never met to work on the same project together. The abilities of forking a repository, then creating a pull request from the forked repo to the original repo is very interesting. I don’t remember bitbucket having this ability, as in the past, I have only created pull request from a branch to another branch within the same repository.

One drawback of this functionality, of course, is that it’s easy to lose track of the latest state of each branch in each repository. Forking easily creates a large number of repos with the same name that a developer will have to memorise. In this case, through creating a PR from the forked repo’s issue-2 branch to the original author’s master branch, I have not touched the forked repo’s master branch. So next time when I wish to work on the same repository again, I will need to remember to update the forked repo’s master branch with the latest changes from the original author first, then update my local copy on disk with it.

Another drawback of github is its incapability of linking an issue and a PR together. The Atlassian set of tools, JIRA, Confluence, and Bitbucket, are designed to do this with ease. Through a JIRA ticket, you can directly create a branch in the desired code repo on bitbucket, and they’re linked together automatically. The naming would also be appropriately generated for you, with the appropriate prefix (bugfix/, feature/, etc), and the appropriate long name of the branch following through (i.e. issue-2475-use-vectorized-operation-on-pandas-dataframe). To compare, if an author of a PR on github has not titled his/her PR appropriately to refer to the correct issue he/she was trying to fix, it’s very difficult for people to figure out the original purpose of the PR.

Lastly, when I did add the manual reference in the issue comment pointing to the pull request, I found out that the ID of the PR and the issue are mis-aligned. My #3 PR is pointing towards my #2 issue, but I can’t change either of these IDs/numbers because they are automatically assigned by github. I can see this being a potentially error-prone point when there are many developers working on the same project.

by Fluffiest Bunny at September 21, 2019 10:36 PM


Cindy Le

OSD 600 Release 0.1

For this Release, we were challenged to file an issue for a bug fix and an issue for a new feature. So I found a classmate’s notepad that I thought would want a bug fix and new feature.

https://github.com/cindyledev/WebNote/tree/issue-1

https://github.com/cagomezr/WebNote/pull/2

The most interesting thing I encountered with this Release wasn’t my fix suggestion for someone else’s repo but actually the many issues and pull requests I got from others. I had to go through each issue and each pull request and in the process, I learned a lot about git that I didn’t know I could do.

I learned how to add a remote, fetch from the remote, create a branch, checkout to different branches, merge, push, pull and git status. Before this class, I only ever worked with my own projects which consists of me using “git add .” , “git commit -m”, and “git push origin”.

I was initially wasn’t impressed by the fixes suggested by my classmates so I emailed my prof with the intention of rejecting the fixes but his response reminded me of an African proverb “If you want to go fast, go alone. If you want to go far, go together” so I ended up accepting two of the three pull requests. I just had to remember that the point of this Release wasn’t really about getting the notepad to work but to learn more git and GitHub.

https://github.com/cindyledev/my-note

by cindyledev at September 21, 2019 09:22 PM


Reza Rajabi


Open Source Contribution on Github


If you want to delve into open source community via Github, contribution and improvement of a simple note-taking app is a great place to start. These are the steps to practice contribution on Github:

- Make an issue on the code you are interested in improving it, or you want to fix any bugs you can see on it.
- Fork the code, so that have it on your account as a new repository.
- Clone the code from your repo to your local machine, so that you can work on it.
- Make a new branch on your local repo to add your changes.
- Improve the code, fix the bugs, and add the updated files to the branch.
- Commit the changes to the branch on your local repo.
- Push your committed changes to your Github repo.
- Make a Pull request, letting the code owner review and pull your updates to the master code.

Of course, contribution needs communication and professional interaction using the tools that Github gives us. So, make messages, comments, reviews, and documentation related to the above steps and enjoy the power of the programmer's community.


For example:
I made an issue on a note-taking app like this: https://github.com/jerryshueh/simple-noter/issues/2. I simply suggested putting the default note into a placeholder. Finally, I fixed the issue, and I made a pull request: https://github.com/jerryshueh/simple-noter/pull/3 which solves this issue. Gladly, the code owner accepted and merged the pull request.


by RaRe (noreply@blogger.com) at September 21, 2019 08:54 PM


Ehsan Ekbatani

My First Contributions and Collaborations in Open-Source

This week I continued my journey into the world of open source by contributing to the work of others, as well as accepting contributions from others for my Micro-Note web app detailed in the previous blog post. I was able to contribute one bug fix, and one additional feature to similar applications built by other students. This was done by utilizing Git features such as posting issues, forking repositories, creating new branches, and creating/receiving pull requests. Details of my contributions are explained below. In addition to these, I also received my first pull request to review nad merge another students contributions to my own application.

Fixing Another Students Bug

One of my colleagues (dbeigi) built a note taking application called "whiteboard" that allows users to save their notes using hotkey inputs, otherwise the application is meant to automatically save the users work every 4 seconds. While I was reviewing the code, I noticed the paramter in the setInterval() function call for the autosave function, was set to "40000". This means the application was auto-saving every 40 seconds instead of 4. After opening an issue, the creator confirmed this was in fact an entry error by him, and allowed to to proceed to fixing it. I forked the repo and created a new branch referencing the issue. I then cloned the repo to correct the code in Visual Studio Code and then pushed it back up to my forked branch using the "git checkout" command to ensure the branch is correct. I then created a pull request referencing the issue and the creator approved, so my contributions were merged into his master branch and his live application.

View Issue
View Pull Request


Adding a Feature to Another Students App

Another one of my colleagues (odaving) built a note taking application called "Whiteboard" that allows users to save their notes using hotkey inputs. One thing I felt it lacked, was complimentary styling that could capture a note-taking look and feel to enhance the user experience. After creating an issue, I went ahead and forked the repo with a new branch and added custom styling using the PaperCSS style-sheet library. I then pushed my changed to my forked repo and created a pull request, that the author eventually reviewed and approved. My contributions were then merged with his master branch, making my contributions live on his app.

View  Issue
View Pull Request

Receiving Another Students Pull Request

Aside from contributing to the work of other, I also learned how to review and merge the contributions of others to my "Mirco-Note" app. After receiving an issue that suggested the addition of hotkey support in my application, I approved and encouraged the issuer to implement the solution he finds best. Once he created a pull request, I reviewed his code and contributions thoroughly and it all checked out. I merged his pull request with my master branch so his contributions can go live in my application, and thanked him for his efforts.

View Issue
View Pull Request

Overall this exercise was highly effective for introducing the core Git functionalities that enable users to collaborate on open-source projects. This increased my confidence as I proceed to my next steps in the world of open source.


by eekbatani (noreply@blogger.com) at September 21, 2019 08:27 PM


Ngoc Nam Khang Nguyen

Release 0.1a - Bugfix in integrating Quill.js

Welcome to my first release!

The two first contributions I made to Open Source are to my colleagues' school projects. The project they completed is two online Notepad-like note-taking apps with different customized features.

The release includes two activities: to report a bug and to suggest a new feature. Let's dive into the first one...

Issue #1: Integrated Rich Text Editor (Quill.js) not working

Links: Repository | Issue | Pull Request

The bug I found while going through many of my colleagues' projects is in the repository mentioned above where I already filed an issue. The bug is associated with the use of an integrated Rich Text Editor called Quill.js.

What is Quill.js?

Quill is a JavaScript library allowing the developer to integrate a highly customizable Rich Text Editor to a webpage. All it needs is an HTML <div> element to be initialized when the DOM is loaded.

An interactive editor box with text formatting functionalities created by Quill.js

Bug Details:

In the app, although the text editor box was created successfully by Quill, all of the buttons on the toolbar do not have any effect on the text.

This bug is caused by the conflict between the method the app stores and retrieves the notes' contents and the method Quill.js manages the notes' contents and their styling. Specifically, the two methods used different data shapes to represent the content;

In the app, the author used the innerHTML property to retrieve and set the current content of the note, for example:
function save() {
var newString = document.getElementById("text").innerHTML;
fs.writeFile("/note", newString, (err) => {
// ...
});
}
The innerHTML property, as its name suggests, uses HTML (represented by a string) as its data format. The browser will normally parse that string as HTML to render the content inside.

However, Quill.js uses a data shape called Delta (also as a string) to represent the content. According to Quill.js' documentation about Delta data shape:
"Deltas are a simple, yet expressive format that can be used to describe Quill’s contents and changes. The format is a strict subset of JSON, is human-readable, and easily parsible by machines. Deltas can describe any Quill document, includes all text and formatting information, without the ambiguity and complexity of HTML."

For example, to represent this string...

Below is the Delta object representing this Quill.js-formatted string!

Quill.js uses this Delta object:

{
"ops": [
{
"insert": "Below is the "
},
{
"attributes": {
"bold": true
},
"insert": "Delta object"
},
{
"insert": " "
},
{
"attributes": {
"underline": true
},
"insert": "representing"
},
{
"insert": " this "
},
{
"attributes": {
"italic": true,
"link": "https://quilljs.com/"
},
"insert": "Quill.js"
},
{
"attributes": {
"italic": true
},
"insert": "-formatted string"
},
{
"insert": "!\n"
}
]
}

As Quill.js uses Delta to represent the content, the browser is not capable of parsing the it; therefore, innerHTML property cannot be used with element taken over by Quill.js.

So... how do we fix this bug?

Fortunately, Quill.js does not just provide an element with fancy styling and a few buttons, it also facilitates a robust set of API dedicating to programmatically customize the module and manipulate the content.

For our purpose, we will focus on the set of methods that help us set and retrieve the content which is the 3 methods: getContents(), setText(text) and setContents(deltaObj).

The method getContents() will return the current content of the editor as Delta object while setText(text) receives a string and setContents(deltaObj) receives a Delta object as its argument. Thus, the code in the example above should be rewritten as:
function save() {
var newContent = JSON.stringify(editor.getContents()); // editor is a Quill.js's instance for the div#text element
fs.writeFile("/note", newContent, (err) => {
// ...
});
}
Besides that, when the app's DOM finishes loading, the content should be loaded appropriately, too. Therefore, the below author's initial code...
window.addEventListener('DOMContentLoaded', (event) => {
fs.readFile('/note', 'utf8', function(err, data) {
var content = document.getElementById("text");
if (err)
content.innerHTML = "...";
if (data)
content.innerHTML = data;
})
});
should be rewritten as...
window.addEventListener('DOMContentLoaded', (event) => {
fs.readFile('/note', 'utf8', function(err, data) {
// editor is a Quill.js's instance for the div#text element
if (err)
editor.setText("...");
if (data)
editor.setContents(JSON.parse(data));
})
});
Note that the use of JSON.stringify()  and JSON.parse() would help to store the Delta object as a JSON string in the (virtual) file system.

This fix should eliminate the conflict of data shape; allowing the content of the note to be stored and retrieved alongside with its formatting and styling.

I implemented the solution and, as I hoped, the pull request I made to the author's repository was accepted and merged into their master branch to resolve the issue.

My experience

The first, small lesson I learn from fixing this bug is that whenever you encounter a new, cool tool or library, do not just copy code online and paste it in your work just to achieve your goal. Actually studying the library and looking into their documentation may take you a lot of time but it will surely save you a lot more later... especially if you want to leverage the tool for your purpose.

Moreover, this problem helps me develop a better sense of debugging. The process of fixing requires me to analyze many aspects of the code separately and then combine all the cases together each by each to identify the exact "aspect" that causes the problem. This is among the rare cases where I need to build small testing apps with each aspect of the code; trying to reproduce the bug which was finally found in the least expected part, the innerHTML property.

This experience has been fun. I found it challenging enough to trigger me into studying it and the result was satisfying when I eventually solved the problem. I believe this is not only a helpful activity but also beneficial since I get to contribute to the community and enhance my debugging skill at the same time.

Keep watch as I will be posting Part 2 - Adding an indicator for the saved status of the note.

by Vito Khang Nguyễn (noreply@blogger.com) at September 21, 2019 05:32 PM

September 20, 2019


Andrew Smith

Finally, my Android phone is Google-free

Not so long ago I wrote about how Google removed my app from Google Play, with no explanation. After that they also refused to delete my Google Play Developer account, because there might be people who still have my app even though it’s not in the store any more.

And all along even though I didn’t want to be – I was a Google slave, with my Android phone tied so tightly to Google Play Services that it might as well be an iPhone.

For years I’ve had my phone rooted, set up an iptables-based firewall (AFWall), and connected to the internet mostly through a VPN (PIA) in order to attempt to preserve a little bit of my privacy. That mostly worked, but not entirely. The firewall only started as an app (which gave apps that started before it free access to the internet) and the VPN app was often flaky, and sometimes didn’t work at all.

I don’t remember what triggered it – but I went and found a project called Lineage OS. This is the continuation of CyanogenMod, which I’ve never used because I found it intimidating. But I absolutely love it.

Because my phone is a Nexus 6p (a popular device) – LineageOS had an up-to-date version of Android for it. My phone was already unlocked and rooted, so installation was so simple that I did it several times to try different options.

Ultimately I settled on the default Lineage OS image, without any Google Apps. The results are outstanding.

Even I was surprised to see how much less garbage there is installed on the phone now. It’s not just LG and Samsung and other third parties that put bloatware on your phone. Google is the worst of them. Here’s a short list of stuff missing from my new OS that was there on the old (clean Google) image:

  • Android Pay
  • Carrier Services
  • Cloud print
  • Android connectivity metrics
  • Android partner bookmarks
  • Config updater
  • Device configuration
  • Device health services
  • Device policy
  • Drive
  • Entitlement
  • Gboard
  • Google
  • Google Backup Transport
  • Google Now Launcher
  • Google one time init
  • Google Partner Setup
  • Google Play Games
  • Google Play Movies
  • Google Play Music
  • Google Play services
  • Google Play services for AR
  • Google Play store
  • Google services framework
  • Google support services
  • Google timezone data
  • Hangouts
  • Maps
  • Market-feedback
  • Trusted face
  • Youtube

At first glance – it looks like some of these things I might actually miss. Google Maps is probably the big one for me. But I don’t use anything else from the list, and now that all this bloat is gone – my phone runs exactly as you’d expect a clean operating system to run on good hardware – fast, and pleasant.

And it’s so nice not to be reminded every time I send or receive a text message that the Google Play Services doesn’t have enough permissions (have you looked at the list of permissions that it wants?). Now there is no Play Services. And my firewall is now almost unnecessary.

I’m glad to see that the open source promise has not failed Android. Don’t be confused – Google would love nothing better than to lock everyone into their proprietary ecosystem, but there are probably billions of devices out there that do not use the Google stuff, and their manufacturers invest into keeping the open source Android not just running – but in top shape.

I do wish I could get my mobile banking apps to work (they don’t because they require the google maps library), but I am enjoying my freedom so much now – I know what I’d be missing, and I don’t see myself going back.

Long live open source!

by Andrew Smith at September 20, 2019 02:16 PM


William Hovsepyan

Blog 2

For Lab 2 we compiled a simple HelloWorld program using different compilation options to determine the difference between outputs with each variation.

After the use of the objdump command on our base helloworld program, we can determine that the location of the code and output string are set in the <main()> program section.

Compilation Tests:

Option 1: (Add -static)

When compiling with the -static option, the file size changes and becomes much larger than the original compilation without the option.

Option 2: (Remove -fno-builtin)

When compiling without the -fno-builtin, the file size returns to the smaller size, and the function call changes from <printf@plt> to <puts@plt>.

Option 3: (Remove -g)

When compiling without the -g option, the file size becomes even smaller than the previous files which used the -g option. By disabling the debugging information option, the disassembly output does not include the contents of section .debug_str.

Option 4: (Add additional arguments to printf())

Compilation with additional arguments in the printf did not result in any change in the compilation code. It remained the same as there was not any change in the compilation options.

Option 5: (Move printf() to separate function call)

By moving the printf() function to a separate call (output()) and calling the output() function from the main() function, we can see a change in the object code. In the regular compilation the printf() statement and its content is displayed in the main() code. While during the changed file compilation, the main() function only displays the call to the output() function without displaying any of the content of the output() function.

Option 6: (Remove -O0 and add -O3)

After the object dump, the difference in the compilation code was in the order each was presented. The original options compiled the main() function closer to the end of the compilation, while replacing with the -O3 option caused the main() function to compile much earlier in the code.

by whovsepyan at September 20, 2019 12:51 AM

September 19, 2019


James Inkster

The GitHub Experience

The joys of GitHub can be limitless. To put this in a better perspective, let’s relate it to a more common job, a Grocer. The hard working Grocer, we will say goes into his shift, and first he grabs the Milk that needs to be put out makes sure all the older milk is pushed to the front to ensure that the grocery store is always trying to turn out inventory on a constant basis. This whole process takes him an hour, and is quickly pulled aside for another issue that a customer was having in a different department. Off he goes, and a new customer comes by.

The new customer grabs milk from the front, and realizes that it’s expired, this customer simply knows the fix, however goes to the manager and the Grocer from earlier ends up getting in trouble. Even with the customer doing it without bad intention.

This is a problem that GitHub has been able to solve by removing the ill-intentions and the ability to contribute to other programmers easily without messages getting lost in the translation. To show the simplicity of it, let me show a simple clip of editing someone’s simple notepad and removing a bug.

You simply add your issue with the code – in this case I talked with the individual in person, however it can be simply replied too from the GitHub repository owner, if it’s a feature or fix they would be interested in having completed.

After this, utilizing the ‘Fix #(insert issue command)’ it automatically references the issue, and the owner is capable of closing the issue. If he felt it was necessary.

Now, what’s different about a feature? Well, let’s take a look..

As you can see, it’s created and resolved the same way. Really cool! And it goes directly to who it is supposed too! No going behind people’s back unintentionally!
When we look at the code, I noticed the feature could also cause a lot more code to be created. So, I expect that a lot of features will be more heavily debated thought about before added in bigger projects.

This particular feature shows the following numbers.

I think this is also important, Features can be really cool too add, but it also doesn’t guarantee the owner would find it that useful. So this might require a little bit more dialogue in bigger projects that one could be aware of.

This is though, an option and an ability to discuss and develop, with ease, efficiency and cohesion. Something many other markets of the world wish they could experience. So for a place where toxicity is at an all time low, and seeing people work together fluently, understanding GitHub is a good place to start if these are things you want from a career.

You can see the two repositories where I fixed a bug and added a feature here and here.


by grommers at September 19, 2019 11:24 PM


Ngoc Nam Khang Nguyen

discord.js - A powerful library for interacting with Discord API

Discord.Js

References: Github Repository | Website

One of the first projects attract my eyes when I was browsing on Github trending list is this one. To begin with...

What is Discord?

Discord is a social network/communication platform designed for gamers to find and join communities of fellow gamers of the same interest, as well as, to facilitate an easier, smoother collaborative experience between them in online games. It supports both desktop and mobile device and even has a browser-friendly version that runs smoothly regardless of platform.

The application has been striving in popularity among gamer and tech-savvy community for a while thanks to one special feature - the ability of the user to add plugin or "bot" into their server to automate or perform amazing tasks.

Some examples:

  • A bot that acts as a server member to remind everyone of an in-game Clan War a day/an hour/15 minutes ahead of time.
  • A bot that performs a poll for a certain matter
  • A bot that tracks a tweet and updates the whole server when new or follow-up event occurs... etc.
More importantly, Discord exposes to the community a Web API so that people can build there own bot and publish it to the community. Server owners can add those to their server from the Discord  Store and enhance their server.

Discord.Js makes the process of making a bot easier.

What is Discord.js?

Discord.js is a powerful Node.js module written in JavaScript provides the developers with an Object-Oriented method to interact with 100% of the Discord API. Therefore, it is more programmer-intuitive by giving a higher level of abstraction. Instead of interacting with endpoints with Fetch API, XMLHttpRequests object in Javascript or Axios library, Discord bot developers now only need to use Object and Method well-encapsulated in the library.

A piece of example code from the library's Github repository:

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('pong');
}
});

client.login('token');
The library also comes with very well-written documentation, guide and a Discord server dedicated to helping the community on using and potentially troubleshooting it. Check it out!

Why this tool is interesting to me?

I have been a Discord user for 2 years by today and I always love its flexibility in purpose and extensibility in functionality. I have been using Discord for school work as we have servers for my program, my class and even many of my group projects. I used Discord even more for entertaining purpose. Each server I have 1-2 bot(s) to serve small-medium tasks.

Since Discord is now a big part of my Internet habit, adding even more automation and flexibility to it makes a huge impact for me. Besides that, as a programmer, building something small but possesses hight practicality and then expanding it has always been what I aimed for. For that reason, this tool can help me a lot and is a thing that is worth looking into, so for everyone.

by Vito Khang Nguyễn (noreply@blogger.com) at September 19, 2019 10:42 PM


Matthew Clifford

whiteboardapp

Whiteboardapp is the application I have made for lab 2 in OSD600. How it works is, all input that the user types through into the whiteboardapp is constantly being written to a SQLite database which is located inside of the users own browser client. I’ve added paperCSS to the whiteboardapp to make the text on […]

by smilegodly at September 19, 2019 08:12 PM

discord.py

This semester I will be choosing to work with the discord.py repository. discord.py is an API wrapper for Discord , but, written in Python! The decision for this was because Discord has been an application I use daily to communicate with friends. I also enjoy developing in Python a lot 🙂

by smilegodly at September 19, 2019 08:09 PM


Ngoc Nam Khang Nguyen

My Lightweight Noteboard 1.0

This week, I have been making a small open source project which I call"My Lightweight Noteboard".

Reference to the app: Source Code | Github-hosted Page

What can the app do?

"My Lightweight Noteboard" is a fairly simple web application allowing you to put sticky notes overlayed on its website. The reason  I call it "lightweight" is that the notes are locally stored in a virtual file system in the browser. This is achieved through the use of the Filer.js library.
The app's user interface with 3 notes added
The app was created by plain JavaScript, HTML and CSS with the help of jQuery UI and Bootstrap 4 libraries.

With these old-schooled technologies, the app facilitates a range of features including:

  • Adding an unlimited number of notes
  • Leaving note overlayed at any position on the "noteboard" area.
  • Save note contents with a colour indicator of saved status
  • Removing unused notes

A few potential features I am having in mind to be implemented in the future are:

  • Resizing notes
  • Colour picker for background and text content
  • Simple text formatter/highlighter
  • Ability to work with touch screen

My experience in the project

With Web Development technologies:

The process of creating this single-page app is a fun experience for me. Although the app is simple, it is still challenging to go through the documentation of the jQuery and Filer.js libraries and make them work with plain JavaScript DOM manipulation. I had an opportunity to refresh myself in creating plain HTML/Js/CSS webpage without the support of major frameworks such as React or Angular which I have been working on for a while.

With DevOps tools:

Besides that, the project promotes the professional use of Git and Github that I actually paid attention to creating a new branch when working on a new feature and then merging them back to master. This helps me avoid unwanted changes to be made to the master branch. Another experience with Git/Github is when I was helping a friend with an issue adding a rich text editor library. I forked the project to my account to investigate the code, make changes and make a pull request to fix the issue. This is a good practice in using Git/Github that I will do in the future.

In conclusion...

The app allows you to write and leave personally notes locally on its website.

I feel lucky that I had a chance to build this project myself. I have learned quite new skills from it and will learn more in the process of enhancing the current application.

A more... heavy-weight version

A more technically complex version of the app can also be found here: Souce Code | Heroku-hosted Page

This version is powered by a backend interacting with a MongoDB database.

by Vito Khang Nguyễn (noreply@blogger.com) at September 19, 2019 05:12 AM


Jae You

Compiled C – GCC options

Exploring GCC options

#include 
int main() {
    printf("Hello World!\n");
}

In this lab, we will investigate how:
1) different GCC compiler options, and
2) minor changes to the source code
change the resulting binary called ELF (Executable and Linkable Format) file.

ELF file will be analyzed using the program objdump with these useful options:

-f          # display header information for the entire file
-s # display per-section summary information
-d # disassemble sections containing code
--source # (implies -d) show source code, if available, along with disassembly

0. Baseline

The following GCC options will be used as a baseline/reference point:

-g               # enable debugging information
-O0              # do not optimize (that's a capital letter and then the digit zero)
-fno-builtin     # do not use builtin function optimizations
$ gcc hello.c -o hello -g -O0 -fno-builtin && ll -h
-rwxrwxr-x. 1 jhyou1 jhyou1 25K Sep 18 18:36 hello
-rw-rw-r--. 1 jhyou1 jhyou1  61 Sep 18 17:25 hello.c

The objdump shows the following:

0000000000401126 <main>:
   401126:       55                      push   %rbp
   401127:       48 89 e5                mov    %rsp,%rbp
   40112a:       bf 10 20 40 00          mov    $0x402010,%edi
   40112f:       b8 00 00 00 00          mov    $0x0,%eax
   401134:       e8 f7 fe ff ff          callq  401030 <printf@plt>
   401139:       b8 00 00 00 00          mov    $0x0,%eax
   40113e:       5d                      pop    %rbp
   40113f:       c3                      retq   

1. Add the -static option

$ gcc hello.c -o hello1 -g -O0 -fno-builtin -static && ll -h
-rwxrwxr-x. 1 jhyou1 jhyou1  25K Sep 18 18:36 hello
-rwxrwxr-x. 1 jhyou1 jhyou1 1.7M Sep 18 18:39 hello1
-rw-rw-r--. 1 jhyou1 jhyou1   61 Sep 18 17:25 hello.c

You can immediately notice the size difference in the resulting binary. This is because -static prevents linking with shared libraries (on systems that support dynamic linking). In constrast to the baseline, you can notice that the resulting binary no longer dynamically links printf using the Procedure Linkage Table (plt):

0000000000401bb5 :
  401bb5:       55                      push   %rbp
  401bb6:       48 89 e5                mov    %rsp,%rbp
  401bb9:       bf 10 00 48 00          mov    $0x480010,%edi
  401bbe:       b8 00 00 00 00          mov    $0x0,%eax
  401bc3:       e8 f8 72 00 00          callq  408ec0 <_IO_printf>
  401bc8:       b8 00 00 00 00          mov    $0x0,%eax
  401bcd:       5d                      pop    %rbp
  401bce:       c3                      retq   
  401bcf:       90                      nop

2. Remove the -fno-builtin option

$ gcc hello.c -o hello2 -g -O0 && ll -h
 -rwxrwxr-x. 1 jhyou1 jhyou1  25K Sep 18 18:36 hello
 -rwxrwxr-x. 1 jhyou1 jhyou1 1.7M Sep 18 18:39 hello1
 -rwxrwxr-x. 1 jhyou1 jhyou1  25K Sep 18 19:00 hello2
 -rw-rw-r--. 1 jhyou1 jhyou1   61 Sep 18 17:25 hello.c

Looking at the objdump:

0000000000401126 <main>:
   401126:       55                      push   %rbp
   401127:       48 89 e5                mov    %rsp,%rbp
   40112a:       bf 10 20 40 00          mov    $0x402010,%edi
   40112f:       e8 fc fe ff ff          callq  401030 <puts@plt>
   401134:       b8 00 00 00 00          mov    $0x0,%eax
   401139:       5d                      pop    %rbp
   40113a:       c3                      retq   
   40113b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

The major difference from the baseline is that instead of calling printf, the function puts is called instead.

Recall that the -fno-builtin option disables builtin function optimizations. Because the line printf(“Hello World!\n”); can be performed simply with puts(), the compiler optimizes by reducing the overhead that comes with printf().

3. Remove the -g option

$ gcc hello.c -o hello3 -O0 -fno-builtin && ll -h
 total 1.8M
 -rwxrwxr-x. 1 jhyou1 jhyou1  25K Sep 18 18:36 hello
 -rwxrwxr-x. 1 jhyou1 jhyou1 1.7M Sep 18 18:39 hello1
 -rwxrwxr-x. 1 jhyou1 jhyou1  25K Sep 18 19:35 hello2
 -rwxrwxr-x. 1 jhyou1 jhyou1  22K Sep 18 19:35 hello3
 -rw-rw-r--. 1 jhyou1 jhyou1   61 Sep 18 17:25 hello.c

Notice that removing the -g option led to the smallest file size. Using the objdump, one can see that various debug sections are no longer available. This means that you can no longer use gdb to debug this file:

$ gdb hello3

(...)

(No debugging symbols found in hello3)$ gdb hello3
$ gdb hello

(...)

Reading symbols from hello…

4. Adding arguments to printf()

What happens when you add arguments to printf()?

#include <stdio.h>
int main() {
    printf("hello world %d %d %d %d %d %d %d %d %d %d\n", 0,1,2,3,4,5,6,7,8,9);
}

After compiling with the baseline GCC options, notice how the objdump changes (added linebreaks to highlight):

0000000000401126 <main>:
   401126:       55                      push   %rbp
   401127:       48 89 e5                mov    %rsp,%rbp


   40112a:       48 83 ec 08             sub    $0x8,%rsp
   40112e:       6a 09                   pushq  $0x9
   401130:       6a 08                   pushq  $0x8
   401132:       6a 07                   pushq  $0x7
   401134:       6a 06                   pushq  $0x6
   401136:       6a 05                   pushq  $0x5
   401138:       41 b9 04 00 00 00       mov    $0x4,%r9d
   40113e:       41 b8 03 00 00 00       mov    $0x3,%r8d
   401144:       b9 02 00 00 00          mov    $0x2,%ecx
   401149:       ba 01 00 00 00          mov    $0x1,%edx
   40114e:       be 00 00 00 00          mov    $0x0,%esi


   401153:       bf 10 20 40 00          mov    $0x402010,%edi
   401158:       b8 00 00 00 00          mov    $0x0,%eax
   40115d:       e8 ce fe ff ff          callq  401030 <printf@plt>
   401162:       48 83 c4 30             add    $0x30,%rsp
   401166:       b8 00 00 00 00          mov    $0x0,%eax
   40116b:       c9                      leaveq 
   40116c:       c3                      retq   
   40116d:       0f 1f 00                nopl   (%rax)

The first argument (the “hello world” string at 0x402010) takes up register %edi. The next five arguments (values 0-4) were pushed to registers esi, edx, ecx, r8d and r9d while the last five (values 5-9) arguments were pushed to stack.

This is because syscalls are limited to six arguments and any additional argument is passed to the stack. Note: this lab was done on an x86-64 system. On Aarchie64, registers r0-r7 are used for arguments and return values with additional argument being pushed to stack.

5. Move printf() to a separate function

Let’s see what happens when an extra function call is required before printf():

#include <stdio.h>
 void output() {
     printf("hello world\n");
 }
 int main() {
     output();
 }

There is not much difference from the baseline other than the fact that main() now calls output() and the instructions for calling printf() are now in output().

However, one must be wary that such pointless function calls can add more (although very little in this case) instructions and more overhead to the overall program.

0000000000401126 :
#include <stdio.h>

 void output() {
   401126:       55                      push   %rbp
   401127:       48 89 e5                mov    %rsp,%rbp
         printf("hello world\n");
   40112a:       bf 10 20 40 00          mov    $0x402010,%edi
   40112f:       b8 00 00 00 00          mov    $0x0,%eax
   401134:       e8 f7 fe ff ff          callq  401030 <printf@plt>
 }
   401139:       90                      nop
   40113a:       5d                      pop    %rbp
   40113b:       c3                      retq   

 000000000040113c <main>:

 int main() {
   40113c:       55                      push   %rbp
   40113d:       48 89 e5                mov    %rsp,%rbp
         output();
   401140:       b8 00 00 00 00          mov    $0x0,%eax
   401145:       e8 dc ff ff ff          callq  401126 <output>
   40114a:       b8 00 00 00 00          mov    $0x0,%eax
 }
   40114f:       5d                      pop    %rbp
   401150:       c3                      retq   
   401151:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
   401158:       00 00 00 
   40115b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

6. Replace -O0 with -O3

Recall that the -O0 option instructs the compiler not to optimize. Let’s try compiling with the -O3 option instead:

$ gcc hello.c -o hello6 -O3 -fno-builtin -g
$ ll
 -rwxrwxr-x. 1 jhyou1 jhyou1   24656 Sep 18 18:36 hello
 -rwxrwxr-x. 1 jhyou1 jhyou1   24888 Sep 18 20:42 hello6

There is barely any difference in the file size. But objdump looks different:
with -O0:

0000000000401126 <main>:
401126: 55 push %rbp
401127: 48 89 e5 mov %rsp,%rbp
40112a: bf 10 20 40 00 mov $0x402010,%edi
40112f: b8 00 00 00 00 mov $0x0,%eax
401134: e8 f7 fe ff ff callq 401030 <printf@plt>
401139: b8 00 00 00 00 mov $0x0,%eax
40113e: 5d pop %rbp
40113f: c3 retq

with -O3:

0000000000401040 <main>:
   401040:       48 83 ec 08             sub    $0x8,%rsp
   401044:       bf 10 20 40 00          mov    $0x402010,%edi
   401049:       31 c0                   xor    %eax,%eax
   40104b:       e8 e0 ff ff ff          callq  401030 <printf@plt>
   401050:       31 c0                   xor    %eax,%eax
   401052:       48 83 c4 08             add    $0x8,%rsp
   401056:       c3                      retq   

The key difference is in how it zeroes out the eax register before calling printf().

Without optimization, the value of 0 is moved to the register whereas optimization performs the XOR bitwise operation (which always evaluates to 0 if both operands are of the same value). This is apparently recommended by Intel and AMD – read more on a StackOverflow post here.

Or, if you’d like some light reading before bed, refer to Intel’s 672-page document here (or just Section 3.5.1.8).

by jhyou1 at September 19, 2019 01:22 AM

September 18, 2019


Corey James

Code Review – HelloWorld.c Lab02

Hello, In the following post, I will be looking at seven different ways that you can compile a simple hello world program in C. I will be using the following four flags for the GCC compiler. -g # enable debugging information -O0 # do not optimize -fno-builtin # do not use builtin function optimizations -static …

by user at September 18, 2019 05:44 PM


Siwen Feng

Whiteboard App V1.0

Click here to see my application.

Vision 1.0

Two basic function
  •  "WIPE", means clean content.
  •  "SAVE", the content will be save at browser until new note be added.
When you refresh the web page, the saved note will be show up. This function is based on https://github.com/filerjs/filer.

Functions will be added in the future

  • "PRINT", when click it will download current note with date to local computer

Some git command I have learned from this lab


  • git clone https://github.com/username/repo-name.git 
  • git add filename
  • git commit -m "common"
  • git push origin master

by SiwenFeng (noreply@blogger.com) at September 18, 2019 03:39 PM


Cindy Le

SPO 600 Lab 3 – Assembler Lab (Part 1)

1) Build and run the three C versions of the program for x86_64

2) Use the objdump -d command to print the object code and disassemble it into assembler for each of the binaries

printf("Hello World!\n");
0000000000401126 <main&gt;:
  401126:	55                   	push   %rbp
  401127:	48 89 e5             	mov    %rsp,%rbp
  40112a:	bf 10 20 40 00       	mov    $0x402010,%edi
  40112f:	e8 fc fe ff ff       	callq  401030 <puts@plt&gt;
  401134:	b8 00 00 00 00       	mov    $0x0,%eax
  401139:	5d                   	pop    %rbp
  40113a:	c3                   	retq   
  40113b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)
write(1,"Hello World!\n",13);
0000000000401126 <main&gt;:
  401126:	55                   	push   %rbp
  401127:	48 89 e5             	mov    %rsp,%rbp
  40112a:	ba 0d 00 00 00       	mov    $0xd,%edx
  40112f:	be 10 20 40 00       	mov    $0x402010,%esi
  401134:	bf 01 00 00 00       	mov    $0x1,%edi
  401139:	e8 f2 fe ff ff       	callq  401030 <write@plt&gt;
  40113e:	b8 00 00 00 00       	mov    $0x0,%eax
  401143:	5d                   	pop    %rbp
  401144:	c3                   	retq   
  401145:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
  40114c:	00 00 00 
  40114f:	90                   	nop

syscall(__NR_write,1,"Hello World!\n",13);
0000000000401126 <main&gt;:
  401126:	55                   	push   %rbp
  401127:	48 89 e5             	mov    %rsp,%rbp
  40112a:	b9 0d 00 00 00       	mov    $0xd,%ecx
  40112f:	ba 10 20 40 00       	mov    $0x402010,%edx
  401134:	be 01 00 00 00       	mov    $0x1,%esi
  401139:	bf 01 00 00 00       	mov    $0x1,%edi
  40113e:	b8 00 00 00 00       	mov    $0x0,%eax
  401143:	e8 e8 fe ff ff       	callq  401030 <syscall@plt&gt;
  401148:	b8 00 00 00 00       	mov    $0x0,%eax
  40114d:	5d                   	pop    %rbp
  40114e:	c3                   	retq   
  40114f:	90                   	nop

3) Review, build and run the x86_64 assembly language programs

[cle@xerxes x86_64]$ cat hello-gas.s
/* 
   This is a 'hello world' program in x86_64 assembler using the 
   GNU assembler (gas) syntax. Note that this program runs in 64-bit
   mode.

   CTyler, Seneca College, 2014-01-20
   Licensed under GNU GPL v2+
*/

.text
.globl	_start

_start:
	movq	$len,%rdx			/* message length */
	movq 	$msg,%rsi			/* message location */
	movq	$1,%rdi				/* file descriptor stdout */
	movq	$1,%rax				/* syscall sys_write */
	syscall

	movq	$0,%rdi				/* exit status */
	movq	$60,%rax			/* syscall sys_exit */
	syscall

.section .rodata

msg:	.ascii      "Hello, world!\n"
	len = . - msg
[cle@xerxes x86_64]$ as -g -o hello-gas.o hello-gas.s
[cle@xerxes x86_64]$ ld -o hello-gas hello-gas.o
[cle@xerxes x86_64]$ ./hello-gas
Hello, world!
[cle@xerxes x86_64]$ objdump -d hello-gas

hello-gas:     file format elf64-x86-64


Disassembly of section .text:

0000000000401000 <_start&gt;:
  401000:	48 c7 c2 0e 00 00 00 	mov    $0xe,%rdx
  401007:	48 c7 c6 00 20 40 00 	mov    $0x402000,%rsi
  40100e:	48 c7 c7 01 00 00 00 	mov    $0x1,%rdi
  401015:	48 c7 c0 01 00 00 00 	mov    $0x1,%rax
  40101c:	0f 05                	syscall 
  40101e:	48 c7 c7 00 00 00 00 	mov    $0x0,%rdi
  401025:	48 c7 c0 3c 00 00 00 	mov    $0x3c,%rax
  40102c:	0f 05                	syscall 
[cle@xerxes x86_64]$ cat hello-nasm.s
section	.text
global	_start

_start:
	mov	rdx,len			; message length
	mov	rcx,msg			; message location
	mov	rbx,1			; file descriptor stdout
	mov	rax,4			; syscall sys_write
	int	0x80

	mov	rax,1			; syscall sys_exit
	int	0x80

section	.rodata

msg	db	'Hello, world!',0xa
len	equ	$ - msg
[cle@xerxes x86_64]$ nasm -g -f elf64 -o hello-nasm.o hello-nasm.s
[cle@xerxes x86_64]$ ld -o hello-nasm hello-nasm.o
[cle@xerxes x86_64]$ ./hello-nasm
Hello, world!
[cle@xerxes x86_64]$ objdump -d hello-nasm
hello-nasm:     file format elf64-x86-64


Disassembly of section .text:

0000000000401000 <_start&gt;:
  401000:	ba 0e 00 00 00       	mov    $0xe,%edx
  401005:	48 b9 00 20 40 00 00 	movabs $0x402000,%rcx
  40100c:	00 00 00 
  40100f:	bb 01 00 00 00       	mov    $0x1,%ebx
  401014:	b8 04 00 00 00       	mov    $0x4,%eax
  401019:	cd 80                	int    $0x80
  40101b:	b8 01 00 00 00       	mov    $0x1,%eax
  401020:	cd 80                	int    $0x80

4) Build and run the three C versions of the program for aarch64

printf("Hello World!\n");
0000000000400594 <main>:
  400594:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400598:	910003fd 	mov	x29, sp
  40059c:	90000000 	adrp	x0, 400000 <_init-0x418>
  4005a0:	9119c000 	add	x0, x0, #0x670
  4005a4:	97ffffb7 	bl	400480 <puts@plt>
  4005a8:	52800000 	mov	w0, #0x0                   	// #0
  4005ac:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4005b0:	d65f03c0 	ret
  4005b4:	00000000 	.inst	0x00000000 ; undefined
write(1,"Hello World!\n",13);
0000000000400594 <main>:
  400594:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400598:	910003fd 	mov	x29, sp
  40059c:	d28001a2 	mov	x2, #0xd                   	// #13
  4005a0:	90000000 	adrp	x0, 400000 <_init-0x418>
  4005a4:	9119e001 	add	x1, x0, #0x678
  4005a8:	52800020 	mov	w0, #0x1                   	// #1
  4005ac:	97ffffb1 	bl	400470 <write@plt>
  4005b0:	52800000 	mov	w0, #0x0                   	// #0
  4005b4:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4005b8:	d65f03c0 	ret
  4005bc:	00000000 	.inst	0x00000000 ; undefined
syscall(__NR_write,1,"Hello World!\n",13);
0000000000400594 <main>:
  400594:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400598:	910003fd 	mov	x29, sp
  40059c:	528001a3 	mov	w3, #0xd                   	// #13
  4005a0:	90000000 	adrp	x0, 400000 <_init-0x418>
  4005a4:	9119e002 	add	x2, x0, #0x678
  4005a8:	52800021 	mov	w1, #0x1                   	// #1
  4005ac:	d2800800 	mov	x0, #0x40                  	// #64
  4005b0:	97ffffb4 	bl	400480 <syscall@plt>
  4005b4:	52800000 	mov	w0, #0x0                   	// #0
  4005b8:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4005bc:	d65f03c0 	ret

5) Review, build and run the aarch64 assembly language programs

[cle@aarchie aarch64]$ cat hello.s
.text
.globl _start
_start:
 
	mov     x0, 1           /* file descriptor: 1 is stdout */
	adr     x1, msg   	/* message location (memory address) */
	mov     x2, len   	/* message length (bytes) */

	mov     x8, 64     	/* write is syscall #64 */
	svc     0          	/* invoke syscall */
 
	mov     x0, 0     	/* status -> 0 */
	mov     x8, 93    	/* exit is syscall #93 */
	svc     0          	/* invoke syscall */
 
.data
msg: 	.ascii      "Hello, world!\n"
len= 	. - msg
[cle@aarchie aarch64]$ as -g -o hello.o hello.s
[cle@aarchie aarch64]$ ld -o hello hello.o
[cle@aarchie aarch64]$ ./hello
Hello, world!
[cle@aarchie aarch64]$ objdump -d hello

hello:     file format elf64-littleaarch64


Disassembly of section .text:

00000000004000b0 <_start>:
  4000b0:	d2800020 	mov	x0, #0x1                   	// #1
  4000b4:	100800e1 	adr	x1, 4100d0 <msg>
  4000b8:	d28001c2 	mov	x2, #0xe                   	// #14
  4000bc:	d2800808 	mov	x8, #0x40                  	// #64
  4000c0:	d4000001 	svc	#0x0
  4000c4:	d2800000 	mov	x0, #0x0                   	// #0
  4000c8:	d2800ba8 	mov	x8, #0x5d                  	// #93
  4000cc:	d4000001 	svc	#0x0

6) Looping in x86_64 https://github.com/cindyledev/Software-Portability-and-Optimization/blob/master/Lab%203/basic_loop.s Looping with 0-9 https://github.com/cindyledev/Software-Portability-and-Optimization/blob/master/Lab%203/loop_counter.s

by cindyledev at September 18, 2019 02:31 AM

September 17, 2019


Jatin Arora

Release 0.1: Love Bug

This was the first release of OSD 600. In this release, I was dealing with fixing bugs or adding features in other users repositories who have done Lab 2, mentioned in the previous post. Catching Bugs I first started by finding repositories that might have some bug or some features I can add to. I... Continue Reading →

by jarora4 at September 17, 2019 04:38 PM


Sukhbeer Singh Dhillon

PostgreSQL and Sarama

Two open source projects: How different could they be in their functioning as community projects?

Sarama

I stumbled upon Sarama while doing some research for my Open Source class at Seneca. It is an open source project by Shopify to create a Go client library for Apache Kafka.

This project is licensed under the MIT License which essentially allows anyone to “use, copy, modify, merge, publish, distribute,…” provided that the copyright notice is used in all derivative software/work.

The contribution guide indicates that the community is welcoming and would accept reviews, changes, pull requests provided they follow all guidelines. One thing that strikes out is that they are open to discussions on most fronts. Additionally, they provide Go commands that one can use to ensure code is formatted, linted, supported on different versions and is tested. Code maintainers are using GitHub to allow contributions to the source code.

I followed various pull requests and noticed that the response from contributors and authors was quite quick. For example in this merge, the bug was fixed and merged within a week. The issue was regarding a special case if a certain producer was shutdown, leaving it orphaned. Although the issue closed and reopened multiple times, it followed a procedure of code review, a constructive discussion and supplication of detailed information about the problem.

PostgreSQL

Postgres (as I will refer to it henceforth) is an open source object-relational database with support for JSON columns. It is licensed under the PostgreSQL License which is pretty much the same as MIT or BSD style licenses in its essence.

Elephant in a fieldElephants have a great memory and so should your database. Photo by David Clode on Unsplash

The community works with mailing lists for reporting bugs, submitting patches and providing all sorts of updates. All bugs can be viewed in a date sorted archive. There are guidelines as to how the code should be formatted and composed before it is submitted as a patch. The mailing list used to submit patches is pgsql-hackers.

I followed multiple patches. A lot of them were marked as ‘returned with feedback’ after a long discussion between members. The patches that got accepted went through a long process of discussions, series of tests and reviews. One such successful patch was about providing additional flags for vacuumdb command and was attached as a .patch file to the email.

Contributors are expected to provide regressive tests for their patches. Time taken for most patches to be accepted differed based on their impact and implications on existing code. In this case, the request was completed in around a month and a half.

Conclusion

As is evident, open source projects can vary heavily in the way that their community is organized and mobilized. Even the way contributions are accepted will differ between projects. Lastly, they can be differentiated on the basis of their license type.

by Sukhbeer Dhillon at September 17, 2019 02:37 PM

Notaker

A simple FilerJS note taking app

Use this simple and intuitive app to take notes anywhere you go. It uses FilerJS library to access your browser’s file system in the same way node.js fs module does (with some differences).

It is styled with Bootstrap CSS and uses Trumbowyg, an HTML WWYSIWYG editor.

The app allows you to add notes with relevant different titles.

To allow this, I need to complete a few more steps in the code. Whenever a new note is asked for, a new file should be created. I am looking to switch to a JSON format from the regular current format, so that I can add key value pairs if needed. That can help if one wants to add tags to notes, titles or links at the bottom.

by Sukhbeer Dhillon at September 17, 2019 12:09 AM

September 16, 2019


Ryan Marzec

An intro to objdump: Analysis of a Basic C Program

In my second lab for my software portability optimization class my goal is to goal basic understanding of compiled code. I’ll be doing this by analyzing the ELF(Executable and Linkable Format) file using the objdumb program.

An ELF file may contain object code, link tables, debugging symbols, program data, metadata about the program and ELF sections, and comments

The program ill be analyzing:

#include <stdio.h> 
 int main() {
     printf("Hello World!\n");
 }

the basic compiled code will be run with these compiler options

-g               # enable debugging information 
-O0              # do not optimize (that's a capital letter and then the digit zero) 
-fno-builtin     # do not use builtin function optimizations 

the details about main from the ELF file dump

0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   bf 10 20 40 00          mov    $0x402010,%edi
   40112f:   b8 00 00 00 00          mov    $0x0,%eax
   401134:   e8 f7 fe ff ff          callq  401030 <printf@plt>
   401139:   b8 00 00 00 00          mov    $0x0,%eax
   40113e:   5d                      pop    %rbp
   40113f:   c3                      retq

I” break down what is happening here step by step so that it is easy to understand.

  • push %rbp(register base pointer, start of stack) onto the stack
  • move data from %rsp(register stack pointer, current location in stack) to %rbp
    – this is setting the current location of the stack the base, or start of the stack.
  • move $0x402010 (this is the address of the string containing “Hello World!\n”) to %edi (register destination index, destination of data copies)
  • move %0x0 (the value of zero) into %eax(register z extended)
    – eax is basically storing a function return type
  • call the printf function.
    – @plt here is for Procedure Linking Table
    – <printf@plt> is essentially a small stub that will call the real printf function from an external shared library
  • this move is for the return for main
  • pop %rbp from the stack
  • return

Recompile the code with the following changes:

(1) Add the compiler option -static. Note and explain the change in size, section headers, and the function call.

-rwxrwxr-x. 1 rmarzec rmarzec   24656 Sep 14 20:40 hello
-rwxrwxr-x. 1 rmarzec rmarzec 1720896 Sep 15 20:58 hello_1
0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   bf 10 20 40 00          mov    $0x402010,%edi
   40112f:   b8 00 00 00 00          mov    $0x0,%eax
   401134:   e8 f7 fe ff ff          callq  401030 <printf@plt>
   401139:   b8 00 00 00 00          mov    $0x0,%eax
   40113e:   5d                      pop    %rbp
   40113f:   c3                      retq

As you can see you objdump for the static compiled code is the same but the big difference here is the file size. The static file is much bigger because it is compiling the stdio.h into the executable instread of linking to it as an external file.

(2) Remove the compiler option -fno-builtin. Note and explain the change in the function call.

0000000000401126 <main>:
 113   401126:   55                      push   %rbp
 114   401127:   48 89 e5                mov    %rsp,%rbp
 115   40112a:   bf 10 20 40 00          mov    $0x402010,%edi
 116   40112f:   e8 fc fe ff ff          callq  401030 <puts@plt>
 117   401134:   b8 00 00 00 00          mov    $0x0,%eax
 118   401139:   5d                      pop    %rbp
 119   40113a:   c3                      retq
 120   40113b:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

After removing the no built in file optimization argument from the gcc command, gcc now automatically optimizes the code for you. as printf can take additional arguments and we have only provided a single string, the compiler has optimized it to use the simpler version that only takes the one argument.

(3) Remove the compiler option -g. Note and explain the change in size, section headers, and disassembly output.

-rwxrwxr-x. 1 rmarzec rmarzec   24656 Sep 14 20:40 hello
-rwxrwxr-x. 1 rmarzec rmarzec   22272 Sep 15 20:55 hello_3

Here you can already tell that the file size is slightly small because it no longer holds any of the debug data.
using the -h option for objdump you will see that the compiled version that did not contain the -g will be missing these from the section headers:

25 .gnu.build.attributes 00001178  0000000000406028  0000000000406028  00003080  22                                   
                   CONTENTS, READONLY  
26 .debug_aranges 00000030  0000000000000000  0000000000000000  000041f8  20
                   CONTENTS, READONLY, DEBUGGING
27 .debug_info   00000301  0000000000000000  0000000000000000  00004228  20                           
                   CONTENTS, READONLY, DEBUGGING  
28 .debug_abbrev 000000cc  0000000000000000  0000000000000000  00004529  20
                   CONTENTS, READONLY, DEBUGGING
29 .debug_line   000000f2  0000000000000000  0000000000000000  000045f5  20                             
                   CONTENTS, READONLY, DEBUGGING  
30 .debug_str    00000266  0000000000000000  0000000000000000  000046e7  20
                   CONTENTS, READONLY, DEBUGGING

As for the disassembly output I did not notice any difference from the original.

(4) Add additional arguments to the printf() function in your program. Note which register each argument is placed in. (Tip: Use sequential integer arguments after the first string argument. Go up to 10 arguments and note the pattern).

one additional argument:

0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   be 01 00 00 00          mov    $0x1,%esi
   40112f:   bf 10 20 40 00          mov    $0x402010,%edi
   401134:   b8 00 00 00 00          mov    $0x0,%eax
   401139:   e8 f2 fe ff ff          callq  401030 <printf@plt>
   40113e:   b8 00 00 00 00          mov    $0x0,%eax
   401143:   5d                      pop    %rbp
   401144:   c3                      retq
   401145:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
   40114c:   00 00 00
   40114f:   90                      nop

ten additional arguments:

0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   48 83 ec 08             sub    $0x8,%rsp
   40112e:   6a 0a                   pushq  $0xa
   401130:   6a 09                   pushq  $0x9
   401132:   6a 08                   pushq  $0x8
   401134:   6a 07                   pushq  $0x7
   401136:   6a 06                   pushq  $0x6
   401138:   41 b9 05 00 00 00       mov    $0x5,%r9d
   40113e:   41 b8 04 00 00 00       mov    $0x4,%r8d
   401144:   b9 03 00 00 00          mov    $0x3,%ecx
   401149:   ba 02 00 00 00          mov    $0x2,%edx
   40114e:   be 01 00 00 00          mov    $0x1,%esi
   401153:   bf 10 20 40 00          mov    $0x402010,%edi
   401158:   b8 00 00 00 00          mov    $0x0,%eax
   40115d:   e8 ce fe ff ff          callq  401030 <printf@plt> 
   401162:   48 83 c4 30             add    $0x30,%rsp
   401166:   b8 00 00 00 00          mov    $0x0,%eax
   40116b:   c9                      leaveq
   40116c:   c3                      retq
   40116d:   0f 1f 00                nopl   (%rax)

In the disassembly with the one additional argument you will notice the additional move operation but with the 10 additional arguments you’ll notice that it begins to be pushed onto the stack after the first 5 are stored in different registers.

(5) Move the printf() call to a separate function named output(), and call that function from main(). Explain the changes in the object code.

0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   b8 00 00 00 00          mov    $0x0,%eax
   40112f:   e8 07 00 00 00          callq  40113b <output>
   401134:   b8 00 00 00 00          mov    $0x0,%eax
   401139:   5d                      pop    %rbp
   40113a:   c3                      retq
 000000000040113b <output>:
   40113b:   55                      push   %rbp
   40113c:   48 89 e5                mov    %rsp,%rbp
   40113f:   bf 10 20 40 00          mov    $0x402010,%edi
   401144:   b8 00 00 00 00          mov    $0x0,%eax
   401149:   e8 e2 fe ff ff          callq  401030 <printf@plt>
   40114e:   90                      nop
   40114f:   5d                      pop    %rbp
   401150:   c3                      retq
   401151:   66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
   401158:   00 00 00
   40115b:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

Here you will notice that mains call instruction now calls our newly implemented output function instead to the printf@plt stub, which is now done in our output function

(6) Remove -O0 and add -O3 to the gcc options. Note and explain the difference in the compiled code.

0000000000401126 <main>:
   401126:   55                      push   %rbp
   401127:   48 89 e5                mov    %rsp,%rbp
   40112a:   bf 10 20 40 00          mov    $0x402010,%edi
   40112f:   b8 00 00 00 00          mov    $0x0,%eax
   401134:   e8 f7 fe ff ff          callq  401030 <printf@plt>
   401139:   b8 00 00 00 00          mov    $0x0,%eax
   40113e:   5d                      pop    %rbp
   40113f:   c3                      retq

No noticeable changes when compiling with O3 instead of O0. Maybe this is due to the fact that the program is so basic and we are only calling one function there isn’t really anything to optimize.

by marss64 at September 16, 2019 06:54 PM


Wilson Adams

Lab 2: Compiled C

In this lab, we investigated the relationship between a basic C program and the output generated by the C compiler. The piece of code we used was this ‘Hello World’ program, which I stored in a file called Basic.c:

#include <stdio.h&gt;

int main() {
    printf("Hello World!\n");
}

The code was compiled using the following options:

gcc -g -O0 -fno-builtin Basic.c -o BasicOut

-g –> enables debugging information.
-O0 –> do not use optimizations .
-fn-builtin –> do not use built-in function optimizations.

Running objdump -d BasicOut, the assembly of the program is displayed, below is the main section from our code above:

0000000000001135 <main&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi # 2004 <_IO_stdin_used+0x4&gt;
    1140:       b8 00 00 00 00          mov    $0x0,%eax
    1145:       e8 e6 fe ff ff          callq  1030 <printf@plt&gt;
    114a:       b8 00 00 00 00          mov    $0x0,%eax
    114f:       5d                      pop    %rbp
    1150:       c3                      retq
    1151:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
    1158:       00 00 00
    115b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

If we recompile the code, adding on the -static option:

gcc -g -O0 -fno-builtin -static Basic.c -o BasicOut1

We can see a sharp rise in the size of the output files:

ls -lh
total 2.0M
-rw-rw-rw- 1 wadams wadams   61 Sep 15 14:51 Basic.c
-rwxrwxrwx 1 wadams wadams  19K Sep 15 14:52 BasicOut
-rwxrwxrwx 1 wadams wadams 741K Sep 15 15:00 BasicOut1

When I ran objdump -j BasicOut1, it contained a lot more sections than the BasicOut file. This is because the -static option tells the compiler to prevent linking with shared libraries, so the libraries needed to run this program are inserted into the BasicOut1 output file.

If we recompile the program, this time removing the -fno-builtin option:

gcc -g -O0 Basic.c -o BasicOut2

the way our program was transformed by the compiler is different:

With -fno-builtin

0000000000001135 <main&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:       b8 00 00 00 00          mov    $0x0,%eax
    1145:       e8 e6 fe ff ff          callq  1030 <printf@plt&gt;
    114a:       b8 00 00 00 00          mov    $0x0,%eax
    114f:       5d                      pop    %rbp
    1150:       c3                      retq
    1151:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
    1158:       00 00 00
    115b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

Without -fno-builtin

0000000000001135 <main&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:       e8 eb fe ff ff          callq  1030 <puts@plt&gt;
    1145:       b8 00 00 00 00          mov    $0x0,%eax
    114a:       5d                      pop    %rbp
    114b:       c3                      retq
    114c:       0f 1f 40 00             nopl   0x0(%rax)

The -fno-builtin option tells the compiler not to use optimizations for built in functions. The change can be seen in the line two highlighted lines above. The un-optimized version of the code uses the printf function, while the updated version uses the puts function. The difference between these two functions is that puts only displays strings, while printf can display many different types of variable values. This is also why the un-optimized version has more commands, as it needs to set the output type for the printf command.

If we recompile the code again, this time without the -g option:

gcc -O0 Basic.c -o BasicOut3

We can see the file size has gone down a little for BasicOutput3:

ls -lh
total 816K
-rw-rw-rw- 1 wadams wadams   61 Sep 15 14:51 Basic.c
-rwxrwxrwx 1 wadams wadams  19K Sep 15 14:52 BasicOut
-rwxrwxrwx 1 wadams wadams 741K Sep 15 15:00 BasicOut1
-rwxrwxrwx 1 wadams wadams  19K Sep 15 15:23 BasicOut2
-rwxrwxrwx 1 wadams wadams  17K Sep 16 12:08 BasicOut3

This occurred because the -g option tells the compiler to include debugging info, this info can be seen when running the objdump --source on BasicOutput2 and BasicOutput3, in the main section:

BasicOutput2

0000000000001135 <main&gt;:
#include <stdio.h&gt;

int main(){
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
        printf("Hello World!\n");
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:       e8 eb fe ff ff          callq  1030 <puts@plt&gt;
    1145:       b8 00 00 00 00          mov    $0x0,%eax
}
    114a:       5d                      pop    %rbp
    114b:       c3                      retq
    114c:       0f 1f 40 00             nopl   0x0(%rax)

BasicOutput3

0000000000001135 <main&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:       e8 eb fe ff ff          callq  1030 <puts@plt&gt;
    1145:       b8 00 00 00 00          mov    $0x0,%eax
    114a:       5d                      pop    %rbp
    114b:       c3                      retq
    114c:       0f 1f 40 00             nopl   0x0(%rax)

The highlighted lines above on the left, show the extra debugging info the -g command adds to the output file. Useful in development, but not to be used in Production code!

Now, if we edit our Basic.c program and add ten arguments to our printf call:

#include <stdio.h&gt;

int main(){
        printf("Hello World! %d, %d, %d, %d, %d, %d, %d, %d, %d, %d \n",0,1,2,3,4,5,6,7,8,9);
}

And compile it with some of the same options we used above, and a new name:

gcc -O0 -g BasicNew.c -o BasicNewOut

We can see in the output of objdump -d BasicNewOut, that we have a bunch more operations in our output file:

0000000000001135 <main&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 83 ec 08             sub    $0x8,%rsp
    113d:       6a 09                   pushq  $0x9
    113f:       6a 08                   pushq  $0x8
    1141:       6a 07                   pushq  $0x7
    1143:       6a 06                   pushq  $0x6
    1145:       6a 05                   pushq  $0x5
    1147:       41 b9 04 00 00 00       mov    $0x4,%r9d
    114d:       41 b8 03 00 00 00       mov    $0x3,%r8d
    1153:       b9 02 00 00 00          mov    $0x2,%ecx
    1158:       ba 01 00 00 00          mov    $0x1,%edx
    115d:       be 00 00 00 00          mov    $0x0,%esi
    1162:       48 8d 3d 9f 0e 00 00    lea    0xe9f(%rip),%rdi   
                                    # 2008 <_IO_stdin_used+0x8&gt;
    1169:       b8 00 00 00 00          mov    $0x0,%eax
    116e:       e8 bd fe ff ff          callq  1030 <printf@plt&gt;
    1173:       48 83 c4 30             add    $0x30,%rsp
    1177:       b8 00 00 00 00          mov    $0x0,%eax
    117c:       c9                      leaveq
    117d:       c3                      retq
    117e:       66 90                   xchg   %ax,%ax

The highlighted lines above show the lines that are different from the original program we wrote. We can also see the additional registers used, %r9d,%r8d,%ecx,%edx, and %esi.

Now, if we edit our Basic.c program again and move our printf call to another function:

#include <stdio.h&gt;

void output(){
        printf("Hello World!\n");
}

int main(){
        output();
}

And compile it with some of the same options we used above, and a new name:

gcc -O0 -g BasicNew2.c -o BasicOutNew2

We can see in the output of objdump -d BasicNewOut2, that we have a new section in our output file, called output:

One Function

0000000000001135 <main&gt;:
    1135:	55                   	push   %rbp
    1136:	48 89 e5             	mov    %rsp,%rbp
    1139:	48 8d 3d c4 0e 00 00 	lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:	b8 00 00 00 00       	mov    $0x0,%eax
    1145:	e8 e6 fe ff ff       	callq  1030 <printf@plt&gt;
    114a:	b8 00 00 00 00       	mov    $0x0,%eax
    114f:	5d                   	pop    %rbp
    1150:	c3                   	retq   
    1151:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
    1158:	00 00 00 
    115b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

Two Functions

0000000000001135 <output&gt;:
    1135:       55                      push   %rbp
    1136:       48 89 e5                mov    %rsp,%rbp
    1139:       48 8d 3d c4 0e 00 00    lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:       e8 eb fe ff ff          callq  1030 <puts@plt&gt;
    1145:       90                      nop
    1146:       5d                      pop    %rbp
    1147:       c3                      retq

0000000000001148 <main&gt;:
    1148:       55                      push   %rbp
    1149:       48 89 e5                mov    %rsp,%rbp
    114c:       b8 00 00 00 00          mov    $0x0,%eax
    1151:       e8 df ff ff ff          callq  1135 <output&gt;
    1156:       b8 00 00 00 00          mov    $0x0,%eax
    115b:       5d                      pop    %rbp
    115c:       c3                      retq
    115d:       0f 1f 00                nopl   (%rax)

We can see with the two different programs side by side, they are have some similarities, even though they have a different number of functions. The two main functions start off the same, but on the third line, is where they split apart. The code on the left calls the printf directly, while the code on the right with two functions calls the separate function we made, Output, and continues to run the same operations but in the second function.

Now, we’re going to recompile the original code one more time, this time using two different optimization options:

gcc -O0 -g Basic.c -o BasicO0
gcc -O3 -g Basic.c -o BasicO3

Then if we view the two main sections from the two output files using objdump -d, we can see how the two levels of optimization differ:

0000000000001135 <main&gt;:
    1135:	55                   	push   %rbp
    1136:	48 89 e5             	mov    %rsp,%rbp
    1139:	48 8d 3d c4 0e 00 00 	lea    0xec4(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    1140:	e8 eb fe ff ff       	callq  1030 <puts@plt&gt;
    1145:	b8 00 00 00 00       	mov    $0x0,%eax
    114a:	5d                   	pop    %rbp
    114b:	c3                   	retq   
    114c:	0f 1f 40 00          	nopl   0x0(%rax)
0000000000001050 <main&gt;:
    1050:	48 83 ec 08          	sub    $0x8,%rsp
    1054:	48 8d 3d a9 0f 00 00 	lea    0xfa9(%rip),%rdi        
                                    # 2004 <_IO_stdin_used+0x4&gt;
    105b:	e8 d0 ff ff ff       	callq  1030 <puts@plt&gt;
    1060:	31 c0                	xor    %eax,%eax
    1062:	48 83 c4 08          	add    $0x8,%rsp
    1066:	c3                   	retq   
    1067:	66 0f 1f 84 00 00 00 	nopw   0x0(%rax,%rax,1)
    106e:	00 00 

Both compiled pieces of code have eight lines, but the operations are very different. Such as the line starting with 1145 on the left, which moves five bytes of data to the %eax register. While the code on the right, at the line starting with 1060, xors the $eax register with itself, using only two bytes of data by comparison, and not wasting 4 bytes on nothing. The order of the other sections within the files are also different, as shown by the different numbers are the beginning of each line, but the other sections were identical.

I was curious to what the differences between the optimization levels were, and I found a website with a good explanation of the differences:

  • -O0: optimization for compilation time (default).
  • -O1: optimization for code size and execution time.
  • -O2: optimization more for code size and execution time.
  • -O3: optimization even more for code size and execution time
  • -Ofast: -O3, with fast non-accurate math calculations.
  • -Os: optimization for code size.

I hope you learned as much as I have from this lab!

by wrmadams at September 16, 2019 06:41 PM


Pavan Kamra

Note-Taking Application

For open-sourced development class, in Lab #2, we were required to make a note-taking application and host it on Github. The main objective of this lab was to work on Github, learn how to use simple commands on git which include - add, commit, and push your work onto the Github platform. Furthermore, it allowed us to be able to work with libraries and implementing it into our own project.

I created a simple note-taking application which allows the user to save their notes after writing it. If the user is to refreshes or comes back to this page in the future, their notes would be saved. The web page is built using HTML, CSS, and JS. I used a library called FilerJS which allowed me to read and write from a file which is used to save the notes for my application. Due to lack of time, the effort for this lab was not the best which I want to improve moving forward in this course.


by Pavan K. Kamra (noreply@blogger.com) at September 16, 2019 11:22 AM


Daniel Ameresekere

Lab 2 – Compiled C Lab

SPO 600 – Lab 2 – Compiled C Lab

In this lab, we investigated the relationship between basic C source code and the output of the C compiler. For this lab, we were asked to compile a C program using one of the servers, AArch64: aarchie or x86_64: xerxes.

I have used the x86_64 (xerxes) server system.

Firstly, I compiled a simple C program to print a message on the screen.

Figure 1 : The code for printing the message “Hello World”
Figure 2 : This is the output when you run this simple program

Then the code was recompiled with the following changes:

(1) Add the compiler option -static

-static

Figure 3 : Prior to adding the compiler option -static

When compiling using the -static option, the file size is increased because it includes the stdio.h header file.

Figure 4 : The file sizes have increased. The original was 24656 and after compiling -static option it increased to 1720896

I would also point out that call function between the original and the -static option are different.

The orignial call function is <printf@plt> while the file with the static option is <_IO_printf>

Figure 5 : <printf@plt> changed to <_IO_printf>

(2) Remove the compiler option -fno-builtin

-fno-builtin

-fno-builtin disables special handling and optimizations of standard C library functions. It tells the compiler to not optimize the printf function call. In the original, the function call is printf@plt (see Figure 3 above). By removing the -fno-builtin, the function call is puts@plt (see Figure 6 below).

Figure 6 : After removing the -fno-builtin option printf became puts@plt

Source: http://www.keil.com/support/man/docs/armclang_ref/armclang_ref_edd1505401721650.htm

(3) Remove the compiler option -g

-g:

The -g option is used to add debugging information to the file. When you objdump the file with the -dsf flags for -g, the there will be section headers that would say “Contents of Section .debug_” telling you that certain content sections are debugged. When you remove the -g option, the debug information will not be shown.

Figure 7 : When the -g option is used it shows the Debug information

I also wanted to point out that the file size decreased when compared to the original.

Figure 8 : When the -g option is REMOVED the file size has decreased from 24656 to 22272

(4) Add additional arguments to thprintf() function

10 Args:

In this option, I am adding additional arguments to the printf() function as shown in Figure 9. The arguments are placed in registers and they are in reversed order.

Figure 9 : Additional arguements added to printf function

For example, I added ten numbers as integers from 1 to 10. Once the file is disassembled, the numbers are moved to registers and in reverse order from 10 to 1.

Figure 10 : The numbers are shown in reverse order from 10 (shown as $0xa) to 1 (shown as $0x1)

(5) Move the printf() call to a separate function named output(), and call that function from main()

output():

For this option, I am moving the printf() function to a separate function called output() so it can be called by the main function.

Figure 11 : Code structure for creating a separate function called output()

For moving a printf() function to a separate function call, when disassembling the file, the output() has it’s own section header call (see Figure 12)

Figure 12 : After disassembling the file

(6) Remove -O0 and add -O3 to the gcc options.

-03:

This option lets the compiler increase the optimization and performance. The following images compare the file before and after optimization.

Figure 13 : Using the -O0 option
Figure 14 : Using the -O3 option

by danielameresekere at September 16, 2019 12:13 AM

September 15, 2019


Yohan Choi

SPO600 - Lab 02: GCC compile options

Introduction

To optimize programs, the rule of a compiler is crucial. This time, I will analyze each compiler options. To accomplish the goal, I will use GCC, GNU Compiler Collection with objdump command

I will compile the following code with 4 options:


gcc foo.c -g -O0 -fno-builtin -o foo01 // No compiler optimization option
gcc foo.c -g -O0 -fno-builtin -static -o foo02 // static compile option
gcc foo.c -g -O0 -o foo03 // function optimization option
gcc foo.c -O0 -fno-builtin -o foo04 // No debugging information 
#include <stdio.h>

int main() {
printf("Hello World!\n");
}


GCC Option - Static


When I compile the file with [-static], I can find that the size of the file is larger than the non-static version of the program. Since a static option does not use another external source for runtime, it should contain every data to run. Usually, the static option is used for the recovery system or stand-alone application. 




gcc foo.c -g -O0 -fno-builtin -o foo01
gcc foo.c -g -O0 -fno-builtin -static -o foo02 
-rwxrwxr-x. 1 ychoi63 ychoi63   24664 Sep 15 12:35 foo01
-rwxrwxr-x. 1 ychoi63 ychoi63 1720904 Sep 15 12:36 foo02

GCC Option - Function Optimizations


If the foo is compiled with [-fno-builtin], the compiler does not optimize functions. As you can see the following code, without function optimizations, the program calls printf@plt directly. However, with function optimizations, the program call put@plt instead of printf@plt. But it was hard to find the difference between the two. Perhaps, the program is too small for it. 


// Without function optimizations
int main() {
401126: 55 push %rbp
401127: 48 89 e5 mov %rsp,%rbp
printf("Hello World!\n",1,2,3,4,5,6,7,8,9,10);
40112a: bf 10 20 40 00 mov $0x402010,%edi
40112f: b8 00 00 00 00 mov $0x0,%eax
401134: e8 f7 fe ff ff callq 401030 <printf@plt>
401139: b8 00 00 00 00 mov $0x0,%eax
}
0000000000401030 <printf@plt>:
401030: ff 25 e2 2f 00 00 jmpq *0x2fe2(%rip)
401036: 68 00 00 00 00 pushq $0x0
40103b: e9 e0 ff ff ff jmpq 401020 <.plt>

0000000000401020 <.plt>:
401020: ff 35 e2 2f 00 00 pushq 0x2fe2(%rip)
401026: ff 25 e4 2f 00 00 jmpq *0x2fe4(%rip)
40102c: 0f 1f 40 00 nopl 0x0(%rax)
// With function optimizations
int main() { 401126: 55 push %rbp 401127: 48 89 e5 mov %rsp,%rbp printf("Hello World!\n",1,2,3,4,5,6,7,8,9,10); 40112a: bf 10 20 40 00 mov $0x402010,%edi 40112f: e8 fc fe ff ff callq 401030 <puts@plt> 401134: b8 00 00 00 00 mov $0x0,%eax }
0000000000401030 <puts@plt>:
401030: ff 25 e2 2f 00 00 jmpq *0x2fe2(%rip)
401036: 68 00 00 00 00 pushq $0x0
40103b: e9 e0 ff ff ff jmpq 401020 <.plt>
0000000000401020 <.plt>:
401020: ff 35 e2 2f 00 00 pushq 0x2fe2(%rip)
401026: ff 25 e4 2f 00 00 jmpq *0x2fe4(%rip)
40102c: 0f 1f 40 00 nopl 0x0(%rax)

 

GCC Option - Debugging Information 


GCC supports also debugging information with [-g] command. As you can see, the size of foo01 is larger than foo04 since it contains debugging information. 



gcc foo.c -g -O0 -fno-builtin -o foo01
gcc foo.c -O0 -fno-builtin -o foo04
-rwxrwxr-x. 1 ychoi63 ychoi63   24664 Sep 15 12:35 foo01
-rwxrwxr-x. 1 ychoi63 ychoi63   22272 Sep 15 12:38 foo04

If [-g] options is not applied, then when inspect the program with objdump [-s] 
command ,which displays per-section summary,  does not include the contents of 
section for debugging. 

Where does each argument go in registers?


gcc foo.c -g -O0 -fno-builtin -o foo01 
gcc foo.c -g -O0 -fno-builtin -o foo05 

#include <stdio.h>

int main() {
printf("Hello World!\n",1,2,3,4,5,6,7,8,9, 10);
}


The original Version

int main() {
401126: 55 push %rbp
401127: 48 89 e5 mov %rsp,%rbp
printf("Hello World!\n",1,2,3,4,5,6,7,8,9);
40112a: bf 10 20 40 00 mov $0x402010,%edi
40112f: b8 00 00 00 00 mov $0x0,%eax
401134: e8 f7 fe ff ff callq 401030 <printf@plt>
401139: b8 00 00 00 00 mov $0x0,%eax
}

Edited Version

int main() {
401126: 55 push %rbp
401127: 48 89 e5 mov %rsp,%rbp
printf("Hello World!\n",1,2,3,4,5,6,7,8,9,10);
40112a: 48 83 ec 08 sub $0x8,%rsp
40112e: 6a q pushq $0xa
  401130:       6a 09                   pushq  $0x9
401132: 6a 08 pushq $0x8
401134: 6a 07 pushq $0x7
401136: 6a 06 pushq $0x6
401138: 41 b9 05 00 00 00 mov $0x5,%r9d
40113e: 41 b8 04 00 00 00 mov $0x4,%r8d
401144: b9 03 00 00 00 mov $0x3,%ecx
401149: ba 02 00 00 00 mov $0x2,%edx
40114e: be 01 00 00 00 mov $0x1,%esi
401153: bf 10 20 40 00 mov $0x402010,%edi
401158: b8 00 00 00 00 mov $0x0,%eax
40115d: e8 ce fe ff ff callq 401030 <printf@plt>
401162: 48 83 c4 30 add $0x30,%rsp
401166: b8 00 00 00 00 mov $0x0,%eax
}
*sub <a1>, <a2> : <a1> = <a1> - <a2>
If you observe the first two line in both codes, you can see the follows:
push   %rbp
mov %rsp, %rbp
On the first line, the push instruction inserts its operand onto the top 
of the stack memory.On the second line, the current location in stack moves 
to the beginning of stack. During function call, the first six arguments 
are stored in rdi, rsi, rdx, rcx, r8d, r9d.

The remains are sent to on the stacks
mov    $0x5,%r9d
mov $0x4,%r8d
mov $0x3,%ecx
mov $0x2,%edx
mov $0x1,%esi
mov $0x402010,%edi
Value 1 ~ 5 are in esi, edx, ecx, r8d, r9d. (prefix e and suffix d means 32bits)
In this edi holds the address of the string. 
Then rest of values (6 ~ 10 are in the stack.
The edited version has total 10 arguements which pass printf as parameters.
"$" prefixes immediate values 

*$0x# - Immediate Value which is a constant or literal value argument. It is hexadecimal format

Function Call Difference

What will be different whether a function is called inside main() or outside? To investigate this, I will edit the code.

#include <stdio.h>

void output(){
printf("Hello World!\n");
}

int main() {
output();
}

int main() {
40113c: 55 push %rbp
40113d: 48 89 e5 mov %rsp,%rbp
output();
401140: b8 00 00 00 00 mov $0x0,%eax
401145: e8 dc ff ff ff callq 401126 <output>
40114a: b8 00 00 00 00 mov $0x0,%eax
}
void output(){ 401126: 55 push %rbp 401127: 48 89 e5 mov %rsp,%rbp printf("Hello World!\n"); 40112a: bf 10 20 40 00 mov $0x402010,%edi 40112f: b8 00 00 00 00 mov $0x0,%eax 401134: e8 f7 fe ff ff callq 401030 <printf@plt> }

In the main, output call is called but since there is no argument, we can find mov instructions send 0 as a parameter.

In the code, there is another instruction for the function output. It is also located in the stack. Except for making separated instructions, there is not that big difference between obj files.

GCC Options - [O0] vs [O3]

[O0] option disables optimization whereas [O3] option does binary optimization. Let's see the difference.





// with [O0] option


int main() {
401126: 55 push %rbp
401127: 48 89 e5 mov %rsp,%rbp
printf("Hello World!\n",1,2,3,4,5,6,7,8,9,10);
40112a: bf 10 20 40 00 mov $0x402010,%edi
40112f: b8 00 00 00 00 mov $0x0,%eax
401134: e8 f7 fe ff ff callq 401030 <printf@plt>
401139: b8 00 00 00 00 mov $0x0,%eax
}
// with [O3] option
gcc -g -fno-builtin -O3 foo01.c -o foo07
int main() {
401040: 48 83 ec 08 sub $0x8,%rsp
printf("Hello World!\n");
401044: bf 10 20 40 00 mov $0x402010,%edi
401049: 31 c0 xor %eax,%eax
40104b: e8 e0 ff ff ff callq 401030 <printf@plt>
}
-rwxrwxr-x. 1 ychoi63 ychoi63   24664 Sep 15 12:35 foo01
-rwxrwxr-x. 1 ychoi63 ychoi63   24904 Sep 15 19:17 foo07

As you can see the [O3] option delete unnecessary binary value such as 0. In addition, it uses
xor instructions which perform a bitwise operation - exclusive or. If the values of %eax, %eax are equal, it returns 0 or not it returns 1. By doing so, the edited version reduce one line.


Finish!

Honestly, it was a long assignment. To understand the assembly code, I had to find a lot of information. But thanks to this, I learned about many things registers, call stacks, and assembly code. Even though assembly language may not be used in the future, this helps me to understand computer and programming deeply. Next time, I will be back with a better story.


Reference

by Yohan (noreply@blogger.com) at September 15, 2019 11:47 PM

SPO600 Lab01 - One step closer to the open source: different license and communications in open source

In the Beginning, it seems to be challenging to join open-source projects since I didn't know what exactly I want. But searching trending helps me to find what I am into. I am into image processing or 3D graphics, three.js and AR.js attracted my attention. However, I had to find different types of license projects and I found out that many of the projects use MIT license. Then, I tried to find another, it was fullPage.js. In this blog, I will share briefly what I see from these projects.


three.js

three.js is a JavaScript library which supports 3D graphics. It is still on the project to target WebGL 2.0. Its license is MIT license which does not restrict for any purpose even for commercial use. For that reason, most of the open-source projects in GitHub uses MIT license. I got into this project because I was wondering how 3D graphic works with JavaScript on the browser. When I checked pull-requests to see the patch history, I could see 195 open requests and 8159 closed requests. Most of the cases, pull-requests were accepted by the owner of the git repository. But the pull requests were usually about documentation works. So I wanted to see pull-request with many comments. Perhaps half of them was debating about the pull-request and many cases the request was rejected. Usually the project member responses within 2~3 days. It seems like the project is very active.

fullPage.js

fullPage.js is usually a library help to create beautiful fullscreen on the web. Interestingly, fullPage.js has two types of license. It provides commercial license and open source license together. Unless a user purchases the license, the user must use GNU GPL License v3. which allows commercial use of the software but the source code should be public. Even though the project is an open-source project but the organization makes profits with their license policy. the patterns of pull request were similar to three.js. After the pull-request was review and if it makes sense, the owner accepts without specific mention. However, if something does not make sense or not clear, the owner asked questions. It can be considered a kind of feedback for the authors of pull-requests. 


Conclusion

It seems to be challenging to join in an open-source project but I can apply what I have seen. I learned lessons from the previous pull-request history and different types of license policy. First, when I choose an open-source project, I should choose an active project. I can check this contributor tab and pull-request history to see how the project is active. Second, the type of license can affect the way people use this. Third, it will be useful to join projects which I use a lot. Finally, participating in an active project can get feedback about my code. 



by Yohan (noreply@blogger.com) at September 15, 2019 11:39 PM


Wilson Adams

Lab 1: Code Review

For this lab, we were asked to research two open source projects, and observe the entire review process for code submissions. For this lab, I chose ShareX and vscode.

ShareX

ShareX is a Windows-only screen capture/productivity tool, and it uses the GNU General Public License v3.0. This application is written in C# and uses the .Net Framework. It is hosted on GitHub, which is where they allow contributions to the project using Pull Requests. I followed issue #3769, which I thought was an interesting saga. It was first opened on November 19th, 2018 by user Danielku15, who proposed a change to the ‘default select tool’. This issue had a lot of detail (at least compared the others I saw), and the user even dug into the code to where they thought the issue could be fixed. There were no replies to the issue until about January, where other users were stating how they would also like this update as well, a few more of these messages popped up every month. On April 4th 2019, a pull request (#4058) was submitted for this issue, by none other than the requestor themself, Danielku15. The issue was marked ready for review, and the same day Jaex, one of the two primary developers, reviewed the change. Jaex and Danielku15 talked about the change, issues/fixes with the currently submitted code, where to place it in the UI, and how the icon should look. This went on for about 10 days, then it was submitted into the main branch. The issues the two spoke about were then corrected with a second pull request (#4084) submitted by Danielku15. The same process occurred, the two spoke about the code, and after a few changes, it was submitted to the master branch by Jaex on April 29th. I also looked at pull request #1352, which was submitted by the other primary developer, McoreD. Which was reviewed the same day by Jaex, and submitted to the master branch. There were no comments on this pull request, just opened and submitted. I thought this was an interesting contrast to the user-community submitted change.

vscode

vscode is source code editor, it is very customizable, and has all the great stuff a code editor should have. It is developed by Microsoft, and the source code is released under the MIT license, and the completed application is cross-platform. I thought this repo was interesting, because the development that happens on this repo goes in two directions, into Microsoft’s Visual Studio Code application which follows the typical non-floss Microsoft license, and into the VSCodium project which continues the use of the MIT license. The Microsoft final product contains all the telemetry tools they use, while the VSCodium version does not. To contribute to this repo, there is a guide that shows you everything you need to know to have your code submitted. It wasn’t the first thing listed, but in order to contribute, you will need to sign a Contributor License Agreement (CLA), which I thought was a little odd and too buried on the page. In the guide, there’s a listing of all the tools needed to build the application (Git, NodeJS, Yarn, Python, C++), and the platform specific tools needed as well. It goes over the build process, debugging, testing, and what you can contribute (fixes, ideas, translations, etc.). They even state a few reasons why code might not be accepted, such as performance, user experience, or architectural issues. They also say suggest to look for issues labelled as ‘bug’ or ‘help wanted’, to improve your chance of having your pull request merged. I looked at Pull request #80381, which was submitted by Microsoft employee bpasero. It was a fix for a UI issue, and once it was submitted, a review was requested by bpasero for another MS employee to check the code. The user assigned to the review, isidorn, looked at the fix, tested it out, posted their results and approval. After it was approved, it needed to pass 3 checks, a Build check, a Distro Sync and Merge test, and a CLA test to make sure they signed the license mentioned earlier. Once all that is complete, the change is merged into a release. This all happened within the course of a day, and only involved two people, both working at Microsoft. I also looked at pull request #72628. This was submitted by a community user, and had a different flow than the pull request above. Once this was submitted and ready, a Microsoft employee had to assign a reviewer to the request, who also had to be a Microsoft employee. This request wasn’t completed, as it is still under review, but was added to a ‘backlog’ list of changes that had no set release date. Similar but more lengthy process than the request above, as this took a few weeks to even be looked at.

These two applications have a similar process for contributing code. Code is submitted, reviewed, discussed, approved, and then merged. The main difference being in the review/discuss/approve portion, as well as the teams behind the development. The ShareX team is a fraction of the vscode team is, and accepts changes from the community a bit more freely. VSCode on the other hand, the team is giant and run by a company that has only recently embraced the open source community. Code is reviewed/discussed/approved in a similar manner, but with a lot more time needed for each step, and involving multiple employees from Microsoft.

by wrmadams at September 15, 2019 03:55 PM

September 14, 2019


Zufishan Ali

My-Note

A web based note taking app.

As part of my Open Source Development class, I was required, for a lab, to create a simple web-based note taking app hosted on Github. The purpose of this lab was to get me started on git, Github, and step into the world of Open Source.

The note taking app I built is called My-Note. It allows users to easily type and save notes directly from the web page. The next time the user enters the page again, their saved note is loaded for them to view or make changes to as they prefer. If they wish, they can also save a copy of their note directly to their computer.

The web page is built using HTML, CSS, and Javascript. The functionality of saving and loading the notes was implemented using a library called FilerJS Browser Filesystem Library. The Hotkeys.js library was used to allow keyboard shortcuts to be used in-order to save the text. FilerSaver.js was used to add the ability to download the note as a text file to the computer. Finally, PaperCSS was used to create a paper sketch style UI.

This lab has been a small yet exciting step into experiencing working in the world of open source. It was interesting that I can use Github Pages to host my web page as this is a feature I was unaware of until now. I enjoyed learning of the various different libraries to implement certain features easily.

Github Repo

My-Note Web Page

by Zufishan Ali at September 14, 2019 11:37 PM


Paul Luu

Analyzing Open Source Licensing and Review Processes

Open source projects

The two open source projects I will be analyzing are Windows Calculator and TensorFlow.

Windows Calculator

Windows Calculator is the calculator application that comes with the Windows operating system. The licensing for Windows Calculator is MIT.

Analyzing the review process

Windows Calculator has a contributing guidelines which explains how to report issues, suggest new features, and contribute to the project.


I would like to understand the review process of Windows Calculator, so I decide to follow a closed and approved pull request #632.

Here is the review process I obverse in pull request #632:

  1. The contributor describes the changes he will implement and how he will validate it.
  2. There are 7 checks the pull request must go through for approval. Building the application, unit testing, signing CLA agreement, etc.
  3. A tag “fixing approved issue” is added to the pull request. This notifies members of Microsoft to review.
  4. A member of Microsoft reviews his code changes and asked questions for clarification.
  5. After the pull request is approved the Microsoft member merges the change to the master branch.

Windows Calculator is a pretty active project from what I saw. The amount of time it took for this pull request to be merge into the master was 11 days. This may be slower compare to other open source projects but is a good way for new contributors to contribute to the project.

TensorFlow

TensorFlow is an open source machine learning framework created for community use. The licensing for TensorFlow is Apache-2.0.

Analyzing the review process

Just like Windows Calculator, TensorFlow has it’s own contributing guidelines that explains coding styles, running unit test, etc.


Following pull request #32504, I found that the pull request was approved on the same day it was raised. This means TensorFlow is a very active project that seems to get pull requests on a daily basis. Most pull requests are not merge to the master branch, but onto other branches.

Here is the review process I obverse in pull request #32504:

  1. The contributor describes an ID code. (Unsure what the ID means)
  2. There are 8 checks the pull request must go through for approval. The checks do not appear on the “Checks” tab, so I am unsure what is actually checked
  3. A tag “size:S” is added by a bot. (size:S meaning a small size change)
  4. A member of TensorFlow approves the pull request and merges the change to a branch.

TensorFlow seems to be a very fast pace environment with many knowledgeable people working on it. This may be off putting for new contributors that want to contribute to the project. One may need to understand the TensorFlow very well before they can start contributing features or bug fixes to the project.

by pluu3 at September 14, 2019 10:10 PM


Paul Jamieson

make Life Easier

If you are ever working on a program without an ide and need to compile it many times you should become familiar with ‘make’. Make is simple program that can be used to script compiles allowing programmers to run a single command to recompile only whats changed since the last compilation. This can save time by only compiling what it needs to be and avoid mistakes that we are all prone to make.

When you write a large programs you will have many source files that are all used to build your application. Depending on how your application works a change to a source file may only impact a small section of your application. If you are not sure which parts are affected you may end up re-compiling source code that does not need to be re-compiled. If your application is small this may only take a few minutes but in a large application a full re-compile can take days. Learning how to use make with your small programs will greatly benefit you when your application grows.

Make uses a scripting language to do its thing and if you are familiar with bash scripts a lot will look familiar.

A simple MakeFile

In this example there is a section ‘all:’. When make is run (simply type make at the linux prompt) it will look for the MakeFile in the directory and run the ‘all:’ section by default. This is the same as ‘make all’. On the same line all the section headings that you want to run will be list. In this example an inline substitution is used for the BINARIES variable and could also read as ‘all: loop’. Any further sections are separated by space on the same line, ‘all: loop clean’ for example.

Next we have the binary section header ‘loop:’ In this section you can setup what you want to happen when ‘make loop’ is used. Loop is also on the ‘all:’ line so it will run if specified on not. This script runs 2 linux line commands when loop is specified. Here it runs ‘as -g -o loop.o loop.s’ followed by ‘ld -o loop loop.o’. ‘as’ is the assemby compiler using -g substituted for ${AS_ARGS} outputting an object file named loop.o from source code loop.s. The next line is the linker ‘ld’ that produces the output of loop (the binary) using the object file loop.o.

Combined those two commands are needed to compile from source to binary. If you were to type them out every time you wanted to compile your code and test that it works you are bound to make a mistake. Using make it will work every time the exact same way.

You can also add sections like ‘clean:’ that are for ‘house keeping’. Here the clean command cleans the folder by running the lines following its section heading.

When make is run it will not run from top to bottom. It will start in the section specified at the command line or all nothing is specified. From there it will bounce around to any other section header as specified and recompile and section that is affected by re-compiled code. Perhaps in a future post I will go into more detail of how the more complex dependencies work.

If you want to taker a deeper dive gnu.org has great resource on the topic and gives an example of a very complex make file with explanations to make it easy to understand.

by Paul Jamieson at September 14, 2019 08:20 PM


Ryan Marzec

Code Review Process in Open Source Projects Part 2

In part 1 I looked at the process to contributing a patch to the gcc project which can be found here.
I’ll be continuing by looking at the Apache HTTP Server project httpd which was launched in 1995 and has been the most popular web server since 1996 from The Apache Software Foundation.

Name    : httpd
Version : 2.4.41
License : ASL 2.0
URL     : https://httpd.apache.org

Submitting Patches:
Contribution to the httpd project is done through an SVN repository, Apache Subversion which is Apaches open source version of a control system. Similar to gcc code must follow the Apache style guide found here.

When contributing to the project one must first check out a copy of the file they wish to work on into a private working directory and frequently synchronize with changes made to the repository.

After ensuring that your changes work, generate a patch so others can apply the change and test it.
This file (patch) will be mailed to the developers list for consideration.

If other developers deem your changes as Good your patch will be checked into the repository.

A more detailed approach can be found here in the Apache developer notes which will also provide a guide to working with SVN.

Review of a Successful Patch Submission:

Bug 57300 – mod_session_dbd should not save the session at each request:

  • Number of people involved: 4
  • Roles in the community and project: I was unable to pinpoint exact roles of the members involved but everyone involved beside the original poster where listed in patch contributors.
  • Process review time: 2014/12/02 to2019/08/09
    – Communication stops in 2015/10/19 with updated tests that match changes made in reference to a revision to the trunk
    -Bug report isn’t closed until 4 years later in 2019 when it was backported in the revision here
  • responsiveness of participants:
    – The initial report doesn’t see a response for about 8 months, which appears to address the issue brought up in the original post with a patch
    – Following this the communication continues over the next two months
    – Finally closed almost 4 years later in 2019
  • Issues discussed:
    – mod_session inefficiency
  • Issues resolved:
    -proposed new directive SessionExpiryUpdateInterval added to mod_session for a 1-20x improvement in time required.

by marss64 at September 14, 2019 07:58 PM


Paul Jamieson

Can I Assemble That?

This week in my SPO600 class we took stab at writing some assembler code by writing the same program to run on an x86_64 and aarch64 cpu. During my time at Seneca College I have learned to code in many languages ranging from C to Swift. Each language built upon the knowledge I had gained in previous classes and while different they we similar enough that after the traditional ‘Hello World!’ app I would start to feel at home. This was not the case with assembler.

With the assembly language you are talking directly to the CPU and manipulating the memory in ways other languages abstract away from the programmer. To work with a bit of data it must be moved into the CPU registers and manipulated by the use of CPU instructions. To make it even more complicated each CPU can work in different ways and have completely different CPU instruction sets. In the early days of computing this was a major problem for programmers requiring them to create new versions of their programs to work on different CPUs. Today we have a few major instruction sets used in majority of hardware giving programmers a reliable customer base for the software they create.

I have created 2 versions of the same program that does 30 loops and writes a message to the standard output on each loop. The message says “Loop: ##” with the ## being replaced with the loop count starting at 0.

Using the x86_64 instruction set I got the programming working using this code. I commented most lines to highlight what each step was doing.

I then wrote the program using the aarch64 instructions.

Upon first glance both sets of source code look similar but at a closer inspection there are differences in how each CPU does each task. The most common instruction from each source code is the mov instruction. Both do the same thing, move a value from one place to another but the order is different. X86_64 does it by ‘value to move, register’ while aarch64 does it the opposite using ‘register, value to move’. To do division on x86_64 one instruction returns the quotient and the remainder but to do the same on aarch64 requires 2 instructions. The aarch64 way looks more efficent but then after reading the notes x86_64 needs you to zero out a register ahead of time to get the remainder and the divisor must be mov(ed) into a register that the div(ide) instruction uses to complete it’s operation.

So which one is better? I don’t think either is better overall but how they operate is different. I found working with the x86_64 instruction set easier then the aarch64 set but overall the differences were small enough that the learning curve for both was about the same. Both were a pain to debug. After writing this short program I have a new appreciation of gcc and the debug messages it provides. After using visual studio for so many years I felt lost not being able to step through my code and see my variables and object field values change as they were acted upon. If I continue to write any assembly code I think spending some time to find an IDE for assembler would boost my productivity. A quick look over the SASM website shows a lot of the features I could have benefited from during this experience.

by Paul Jamieson at September 14, 2019 07:28 PM


Evelyn Yeung

Cornell Method Notetaking App

For our second lab, we were tasked with creating a simple serverless notetaking web app using FilerJS, and implementing some interesting features.

I decided to follow the KISS principle and create a page that allows you to utilise the Cornell method of taking notes, which I used heavily in my time as an English major. There is also a ‘Clear’ button that makes it easier for the user to start over. My code can be found on my Github here

Up to this point, I have never used the contenteditable attribute (nor did I even know it existed!)

I also had to spend a bit of time re-learning how to code for the web as I had forgotten most of it (my current job requires only the most basic HTML, and my courses last semester were in Java/C++). 

Additionally, I have only ever really used markup for the occasional Reddit comment, so I spent some time acquainting myself with it for my README document. 

September 14, 2019 06:26 PM


Sarika Hanif

My-Note: Online Note Taking App

For my second lab studying open source development, our task was to create an online note taking application. It was a relatively simple application to create. It was written in HTML and JavaScript. Our task was to have a text box that when written to, it would save the text every 2–5 seconds. When refreshed or when the page is reopened the saved text should still be there. If there was an error it would print a default line.

It was required that we used the FilerJS Browser Filesystem library. It was a new library that I haven’t used before, but the documentation was simple to follow. I used the read and write file functions to read and write the text into the text box. I learned about the setInterval function, which calls the specified function at a specified interval measured in milliseconds.

I added a few additions to the code. I used BootStrap framework to add some buttons. I added a reset and save button. The reset button resets the text box to the default string. The save button saves the text within the text box as a file. To do this I used FileSaver.js. I haven’t used this before and the documentation only had installation for npm and bower, so I had to find a CDN to incorporate into my code.

Overall I learned about 2 new libraries, FileSaver.js and FilerJS, and how to use them.

Checkout my repo at: https://github.com/s-arika/my-note

or

Demo: https://s-arika.github.io/my-note/

Thanks for reading! ✌🏼

by Sarika Hanif at September 14, 2019 03:51 PM


Ilya Zhuravlev

Meet z-Note!

This week I was working on a pretty simple and straight-forward online notepad, called z-Note.

Well, that’s Notepad — what did you expect?

The z-Note notepad allows the user to make a note (nothing but a plain text), save it, close your browser, open the page again — and the note will still be there. That is the main concept of this “easy Notepad” and the main goal, that was set and achieved for this release.

z-Note version 0.1 release

The notepad has a neat and responsive UI, including the clean design, achieved by using PaperCSS framework and note status messages. It is written using HTML, CSS and JavaScript. To successfully store user’s note I have used Filer library, which allows you to create and operate a simple and light-weighted file system.

I believe, that this project will be both a great practise for me, and a lot of fun. This is the first open-source project I have started, and I look forward to improving it and implement new features.

In the nearest future, I would like to fix the User Interface, make it possible to download the note on your desktop as a .txt file and add support for multiple notes.

If you are interested in code or would like to collaborate — feel free to visit the project’s repository: https://github.com/izhuravlev/z-Note

by Ilya Zhuravlev at September 14, 2019 05:09 AM


Haichuan He

My Notepad App

For the first open source app, I developed a simple notepad to store text. The user will be able to input text in the text box. The text will automatically get saved every 5 seconds or the user can click on save button. It is a good experience to learn git and github. I have learned how to create git repo, clone it to local desktop, commit changes, and push it back to master branch. I have also learned how to host Gh-pages on github. Furthermore, I have changed the title fonts to one of the Google fonts.

The link to my notepad app source code:

https://github.com/haichuan0424/my-note

The link to my app webpage:

https://haichuan0424.github.io/my-note/

by Tony He at September 14, 2019 01:26 AM


Calvin Ho

Whiteboard App

Lab2

Of the OSD600 class, we were tasked with writing a online notepad app with Javascript. The end result is the following.

It was a nice refresher to start off the school term. It was also pretty embarrassing as I wasn't able to get output on my screen even though I thought I had the code right... Asked the professor to come over to help me take a look and he mentioned a few lines in my code wasn't right because it was written like React instead of vanilla Javascript.

On top of using Javascript, I also included PaperCSS for the change in the font and to make it look more like a notepad app instead of a browser with editable text.

Lastly, Hotkeys.js was used to create a ctrl+s command that will save the text in the browser every time it is pressed, the default command was overridden/prevented to prevent the browser from attempting to save the current web page.

One technical thing I did learn from this assignment was never to use document.querySelector.write and instead use document.querySelector. I'd like to thank the professor for this.

by C3HO (noreply@blogger.com) at September 14, 2019 01:02 AM


Rafi Ungar

Zennotate: on first open source experiences

I have finally taken my first leaps into the world of open source by both publishing my own—as well as contributing to another student’s—first open source project!


Zennotate (on GitHub) is a minimalist note-taking web applet that takes inspiration from the visual aspects of the teachings of Presentation Zen. In the backend, the project uses Filer to store and retrieve note data from the browser’s local storage. As the project makes relatively-heavy use of DOM manipulation, jQuery is used to simplify (and beautify) syntax throughout.

On the styling side of things, Bootstrap 4 and a nifty project called legitRipple.js are put to good use. Bootstrap easily enables responsiveness in the UI, making Zennotate look great on both desktop and mobile screen sizes.

legitRipple adds a unique twist to the project: the ability to spawn off rippling CSS effects across several page elements when clicked. Zennotate spawns ripples when the user clicks on any of the applet’s foreground elements (including the Save button), when the applet is (re)loaded, or when the user saves their work using the added Ctrl+S keyboard shortcut (to provide some nice feedback).

The project additionally uses a fairly zen Google Font, Didact Gothic, throughout:

ZennotateZennotate, a minimalist open-source note-taking applet. Check it out here.

I decided that I wanted to contribute a hotfix to a fellow student’s open-source “Notepad” applet after discovering a small issue with it. In order to make this contribution, I first had to learn how to fork a repository and make a pull request from it—two GitHub procedures that I had previously had no need to follow in the past.


While my first steps into open-source contributions were completed in the span of hours, they mark the start of a years-long journey; one that I am more than happy to dive right into.

by raungar at September 14, 2019 12:59 AM


Thomas Luu

Playing with GitHub and Filer

Last week, I talked about how I wanted to contribute to VS Code. Today, I practiced using Github to better prepare myself for the endeavour. It’s been a while since I have touched Github so I used the platform to host a simple web application as practice. This involved setting up git repo and implementing a web app that incorporated Filer.

Setting Up a Repository And Discovering Gh-Pages Hosting

First, a Github repository was created and then it was cloned onto my local machine. This allowed me to easily manage the changes in my code and have those changes pushed to Github. Standard Procedure. Now the one fact I did not know before was that Github is able to host our web content for us. A great discovery and all it required was going to the settings and changing GitHub Pages > Source to master.

My Simple Filer Implementation

My implementation can be found here. Basically, you can edit the text at the top and if you hit save, Filer will retain the text by writing that text to a file. Upon reloading the web app, Filer reads the previous text file and displays its content in the box. If the text file is empty or does not exist, a default message is displayed. The previous iteration of the web app saved the text at regular intervals but it felt like a waste of resources so I implemented a button for the current iteration.

by trusolz at September 14, 2019 12:43 AM

September 13, 2019


Yohan Choi

Developing a Note-Taking App - Step 01

Developing a Note-Taking App - Step 01


Introduction

In this semester, I am taking the Opensource Development Course. This week I had to develop a simple note-taking app which runs on the web. I and other classmates will upload source codes to GitHub, we will review and contribute our source code for each other. The ultimate goal of this project is to help us gain experience for open source development and contribute. 

Settings

My note-taking app will run on the web. It is a serverless application so I will only handle the front-end part. Therefore, JavaScript will be used to build the app. 


Text Code Editor: Visual Studio Code, Brackets

Below is the list of the libraries used or will be used

Features

Right now I have implemented the essential parts, saving and loading functionality due to the time limit. To implement the file system, I used FilerJS which helps to make reading function and writing function on inner html easily in this project.

In this time, I focused on the CSS part such as normalize.css and responsive grid system for the fundamental of the apps. But when I accessed to Github.io (live web hosting service), I founded out that CSS has not applied on the live web.

Github.io
Original
I searched for the reason of the problem and I found out that git repository's root directory is /docs, not /. But the moment I wrote this post, I cannot sure about it because to apply the change to the live web, it takes hours.

Future Plan

Personally, I have two ideas for this project. One is making the app look like a real desktop application implementing menu bars or toolbars in terms of visual. Another one is making this app a Chrome extension.  Then the usability of this app will be enhanced because a user can use this app more easily. For instance, if we found useful information on an article, simply click Chrome extension then we can save the information into the app easily. Perhaps I should spend more time to design this application to build more complex but it makes me really excited. The next section you can see the source code and live version. 

Application Link



by Yohan (noreply@blogger.com) at September 13, 2019 11:39 PM


Jayson Sherry

Taking notes on the fly


Have you ever needed to take notes but there was no pen and paper around? well i've started woking on a web app that does exactly that. WebNotes is a very small and simple tool that lets you take notes on any web browser, without any of the fancy and complicated tools and settings. The application is not supposed to be the best or have the most features but more of a backup app when all else fails and you just need to take some notes.



The app uses the BSD-2 licence so anyone can use it or modify it to fit their needs. For now the application will automatically save your work and load any notes that you've written before. To save you the trouble of remembering to save, the app will save your work for you every 10 seconds and will display a message showing the last successful save time stamp.

by Jayson Sherry (noreply@blogger.com) at September 13, 2019 09:49 PM


Neil Ong

Web Based Note Taker – foreverNote

Hello friends,

I just wanted to show you all my new web-based note taking app. It’s called foreverNote. Users can post and take notes with it. It automatically saves every 10 seconds, but users can press the save button to save the note anytime they want. It also includes a clear button. This obviously clears the notepad of anything that is in it.

The image below gives you a sneak peek into how it looks like.

This little project was a great refresher into web development and was very helpful.

You can check out the code and try it via gitHub:

Code: https://github.com/neilong31/foreverNote

foreverNote: https://neilong31.github.io/foreverNote/

by Neil at September 13, 2019 07:21 PM


Ryan Marzec

Micro Notes, A Step into Open Source on GitHub

GitHub:

This week in my open-source class at Seneca, the goal was to familiar myself with the ins and outs of GitHub and git, a version control system for coordinating work and managing source code on a project among multiple people.

Now already having a GitHub account I already had some basics down, such things as creating a repo. However, previously I had only used the GitHub desktop application so everything on git was fairly new to me.

In my class notes one of the suggestions was to change gits default editor from Vim, I choose to opt-out of this step as I use vi quite frequently already .

I followed the basic instructions, cloned my repo to my local machine, made the required changes, and pushed the commits, all within the git bash terminal.

I wont bore you with the specific as everything I had done up to this point could be figured out with a 10 second google search.

At this point though, I had completed the basics, yet very important steps in understanding the git environment, with a potential future in open-source these steps might just be used on a near daily basis.

The Project:

The project itself is quite a basic one, just a simple notes taking app. Separated with a few div’s the page contains a header, a section to write down your notes and a button to save your changes, or cancel and remove any new additions to the documents you may have typed out on the page but keep everything that was there previously.

Honestly it took me longer then I’d like to admit, my web development skills have become very rusty, every simple task I found myself on google trying to figure out the right syntax, styles and function for JavaScript and html/css.

Some Features:

  • I updated my save logic and UI to use button instead of it being saved incrementally every few seconds.
  • Made UI responsive
  • Added the css library PaperCSS
  • added a few of my own css styles for the page layout/design

For anyone interested you can check out my source code here and the live version on github.io here.

by marss64 at September 13, 2019 07:13 PM


Hansal Bachkaniwala

Notes Forever: A Note-Taking Web App

Notes Forever in action

For the open-source development course I am taking this semester, I built a simple web app that allows users to take notes. This blog will give a brief overview of the app, its main features and what I learned while building it.

What is Notes Forever?

It is a simple note-taking web app for users to save, edit and retrieve notes as needed. It is a single-page app hosted on Github pages. I started off by implementing a basic HTML boilerplate and used the FilerJS library to read and write the user’s notes to local memory. Then I added additional features. The app was implemented using the following technologies:

• HTML

• CSS

• JavaScript

• JQuery

• Bootstrap

• FilerJS

• Google Fonts

• Font Awesome (for icons)

Features At a Glance

  • Taking notes: As a note-taking app, the core feature is the ability to type notes, save them and be able to access them later.
  • Note grid: The app allows users to add many notes and stores them in a grid. The user can click on any note in the grid, make changes, save them and review them later. Bootstrap grid and modals were used to implement this feature.
  • Dark theme: The app has a black and white theme, with an occasional splash of color, giving it good contrast that makes it easier to read. This was implemented using plain CSS.
  • Autosave: The app routinely saves the user’s work every 2.5 seconds, reducing the need to keep saving notes every few minutes or so. The user can also save their work by explicitly clicking the ‘Save’ button.

Learning Outcomes

  • FilerJS: Building this app was the first time, I used this library. It is very similar to the ‘fs’ module and was the easiest to implement.
  • Bootstrap Modals: Though bootstrap was covered in a previous web course, I really didn’t get the chance to experiment with all the components. I was able to learn and implement bootstrap modals in detail. They were crucial to my note grid feature.

That’s it for this blog. Free free to try out my app here or contribute to the repository here. Thanks for reading.

by Hansal Bachkaniwala at September 13, 2019 07:04 PM


Haichuan He

Intelligent ticket booking tool for China 12306 system

The school course Open Source Development requires me to find a trending open source project on Github and fork it. During the searching process, I am amazed by the amount of open source projects available as well as the number of people working on them.

This project is an intelligent ticket booking assistant for the China 12306 system used for domestic rail transportation. I find this project interesting because I used to travel a lot in China by train and sometime found that it is difficult to book tickets and the booking system is not very intelligent itself. The project acts as an interface developed by Python to the current system. It can automate part of the booking process including user log in, pre-order sales, email notification, etc. It also provide an AI system to help figure out which waitlist to join as well as catching the empty spots while others doing ticket refund. It could potentially save quite significant amount of time for ticket booking especially for peak season such as Chinese new year given how many people will be travelling within the country.

by Tony He at September 13, 2019 07:02 PM


Brett Dennis

Filer.js testing – Micro Note

This week I was introduced to a JavaScript plugin titled filer.js, a plugin to help to read and write to files. And such, after being introduced to this new JavaScript plugin we were instructed to make a test program on GitHub and apply our own spin to it.

And thus, with the assistance of Filer.js, a small program that can read and write to a file on a web server hosted by GitHub available at the following link:

https://ultimabgd.github.io/micro-note/

If the code behind it is of interest, it is available here:

https://github.com/UltimaBGD/micro-note

Now, in addition to the use of filer.js, I have included PaperCSS to make the note saving utility seem as though it is being written on paper to more emulate a notebook and to include a button that displays if the content is saved or not to ensure the user has an idea if their content will be saved, as seen below:

Overall, this was quite the entertaining experience, and the inclusion of PaperCSS makes this file experiment and simple UI oddly charming, and this experience was well worth the effort.

by ultimabgd at September 13, 2019 06:48 PM


Sina Lahsaee

Simple Whiteboard

To get the hang of being a developer in the OpenSource community, I decided to experiment and familiarize myself with GitHub and the features it has to offer. I create a new experimental repository named Whiteboard. This application is very simple, its primary functionality is to help you print your ideas to file.

This save functionality happens automatically every 5000 milliseconds (5seconds), and it can be viewed in the index.html. Additionally, I've managed to use hotkey.js to add a shortcut for manually saving the user's printed ideas to file. However, please note that these files aren't saved to your desired location, so if you'd like to retrieve them, you have to navigate to the browser's cache.

While creating this simple application, I learned about various Licenses available in the OpenSource community, as well as various libraries out there that can prove quite helpful for developers out there, saving us time in our projects.

by slahsaee (noreply@blogger.com) at September 13, 2019 04:28 PM


Krystyna Lopez

Filer Open Source Project

In this Project I have created simple HTML page that function as notepad. I have used FilerJS Browser Filesystem Library This Notepad HTML page allowed any internet user add or delete text from the "sticky note" on the page. Here is the link to the page https://lozinska.github.io/my-note/.
In this Project I applied some CSS features in order to make note area look like a "sticky note". Some pieces of CSS were taken from envatotuts

Learning outcome from Lab 2:

1. How to create GitHub repository
2. How to apply license on my work
3. How to mirror my work on the GitHub
4. How to Push and Set up Gh - Page hosting

Things to be improved:

1. In this Project I would like to add some buttons as "Save" and "Clear".
2. As for now page has only one "sticky note" and I would like to add as much "sticky notes" as user would like and also clear them in the order user would prefer.

Code for the note could be find https://github.com/lozinska/my-note.



by Krystyna Lopez (noreply@blogger.com) at September 13, 2019 04:00 PM


Jacob Shuman

MidNote

Web-based note-taking

What is MidNote?

MidNote is an open source web-based note-taking application.

MidNote is hosted and served by GitHub and GitHub Pages respectively.

How does MidNote work?

MidNote stores a simple note in your browser locally on your computer.

Saving

Although there is a manual “Save Note” button, your note will automatically be saved every 10 seconds.

If you close and reopen your browser, your note will be saved. Be sure that you do no remove the cookies/cache as that will clear your note.

Your note is only saved in the browser you save it in. This means that if you open the site on Google’s Chrome browser you will have a note that is completely separate from Mozilla’s Firefox browser.

Can I help improve MidNote?

I highly encourage and appreciate any contribution you could make to the development of MidNote!

The public Git repository can be found at https://github.com/jacob-shuman/midnote.

If you have any problems with MidNote or would like to add a feature, please feel free to post a GitHub issue.

Is MidNote free to use?

Absolutely!

Anyone can use MidNote 100% free to use!

Where can i find MidNote

You can find and use MidNote at https://jacob-shuman.github.io/midnote/.

by Jacob Shuman at September 13, 2019 01:09 PM


Anton Biriukov

Implementing a Simple Web-based Note Taking Application

A screenshot of My Note Keeper. Photo by Andrey Aldoshkin on Unsplash

In an exciting yet sometimes thorny way into the Open Source community have I had an opportunity to implement a quick note taking app. Based on the following list of technologies, it is fairly simple in its nature:

How does it work?

To start off the development of the app I have created a basic HTML5 document:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>My Web Page</title>
</head>

<body>
<!-- This is a comment -->
<h1>Hello World!</h1>
</body>
</html>

Afterwards, I have added basic elements, such as headers and containers. Note, that contenteditable attribute can be used to make the contents of any HTML5 element editable.

<body>
<h1 align="center">DPS909 Lab 2</h1>
<h2 align="center">My Note Keeper</h2>
<div class="card">
<div class="card-body">
<h4 class="card-title">Enter Notes Below:</h4>
<div class="note" id="note" contenteditable></div>
</div>
</div>
</body>

In order to save notes, it was also necessary to implement the logic to store the input into an innerHTML property of the

<div class="note" id="note" contenteditable></div>

To accomplish this, I used the Filer.js library within the following ES6 script:

const fs = new Filer.FileSystem();
document.addEventListener("DOMContentLoaded", event => {
fs.readFile("/note", "utf8", function(err, data) {
if (err != null || data == null) {
data = "Welcome to my notepad!";
}
document.querySelector("#note").innerHTML = data;
});
});
var saveFile = function() {
fs.writeFile("/note", document.querySelector("#note").innerHTML,
function(err) {
if (err) throw err;
});
};

In addition, for the ease of use the note is saved every 3 seconds:

var interval = window.setInterval(saveFile, 3000);

Adding additional features

A number of extra features were added to the project:

<link
href="https://fonts.googleapis.com/css?
family=Source+Code+Pro&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?
family=Dancing+Script&display=swap"
rel="stylesheet"
/>
In the background you can see banks of the mighty river Volga in the city of Samara in Russia during wintertime. Photo by Andrey Aldoshkin on Unsplash.
  • Navigation bar with save and clear buttons, as well as a number of links
<div class="topnav">
<div class="leftNavContainer">
<button onclick="saveFile()">Save</button>
<button onclick="clearFile()">Clear</button>
</div>
<h1 align="center">DPS909 Lab 2</h1>
<div class="rightNavContainer">
<a href="http://zenit.senecac.on.ca/~chris.tyler/planet/"
target="_blank">CDOT Planet</a>
<a href="https://medium.com/@birtony"
target="_blank">Medium</a>
<a href="https://github.com/birtony/my-note-keeper.git"
target="_blank">GitHub</a>
</div>
</div>

Useful information

While working on this project I have used a lot of Flexbox styling. It is quite an easy and very efficient tool that, in my opinion, every web developer should be familiar with. As mentioned in my previous post, I believe that the most powerful learing is the applied learning. If you think so too, make sure to check out this game and learn Flexbox as a pro!

Flexbox Froggy Screenshot

by Anton Biriukov at September 13, 2019 05:18 AM


Minyi Chen

Simple take note app

Taking note is so easy. This is the first app that I created in open source course. 

Here is the Demo.

I added some futures using the follow links:


1)  filer.js to save data and read data to screen.

Add filer.js script:
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>


readFile()
fs.readFile("/note", "utf8", function(err, data) {
if (err) {
throw err;
} else {
if (data) {
document.querySelector("#note").innerHTML = data;
} else {
document.querySelector("#note").innerHTML =
"Welcome to my notepad!";
}
}
});


fs.writeFile("/note", document.querySelector("#note").innerHTML, function(
err
) {
if (err) throw err;
else alert("data saved!");
});


2) Use Google Fonts:
<link
href="https://fonts.googleapis.com/css?family=Modak&display=swap"
rel="stylesheet"
/>


3) Use Hotkeys.js to create key to save:
<script src="https://unpkg.com/hotkeys-js/dist/hotkeys.min.js"></script>


4) Use PaperCSS for style:
<link
rel="stylesheet"
href="https://unpkg.com/papercss@1.6.1/dist/paper.min.css"
/>




by Karla (noreply@blogger.com) at September 13, 2019 04:23 AM


Hayley McIldoon

My Note

My Note is a web based note taking app using the FilerJS Browser Filesystem library and Trix — a rich text editor control. My Note allows users to create notes and automatically saves notes every 5 seconds. Click here to run My Note.

Extra features I added:

Some features I would like to add:

  • Add a “Save” and “Clear” button
  • Fix the textarea width when the window is resized

I really enjoyed making My Note but I ran into a few minor problems. I was having trouble saving the note before I realized I had forgot to set the data before writing the data! I also had a few syntax errors that I needed to fix.

by hmcildoon at September 13, 2019 02:20 AM


Igor Naperkovskiy

First Git Project

For my first open source app I made a website that uses some javascript as well as HTML/CSS. It’s a small application that allows users to input any information in a note field. The information that is located in the note field will be automatically saved for future use, so that anytime user visits a web page they will be able to see their note. 

For the first open source project, small web app like that was a good start. It was a great way to familiarize myself with git, how to create repository, and learn all the commands to push the project on git.

by soltylis at September 13, 2019 02:12 AM


Charlie Le

Licencesssss

On my adventure to find open source software packages that seemed interesting, I found two that stuck out to me. The first one is “Godot”. An open source game engine that under the MIT license. The second is “Blender”. This is an open source 3D creation tool under the GNU general public license.

GODOT

The MIT license seems to be a very “free” in that the user is able to modify and distribute the code with not much of a hassle. As long as the user includes the MIT license with their software distribution.

There are two ways people can contribute to GODOT. One of the ways would be in the form of patches. This would be done by describing how these changes are to be done in a way that’s actionable on a text file. The other way would be through pull requests. This could be a proposal that would merge the contributors git commits into the main development branch. This is all done in an upstream manner to ensure that other developers will be able to review and improve your code.

The patch I chose to review from GODOT is the one of status code 31377. This patch was for fixing the game engine’s editor buttons. When deleting one of the user’s projects, some buttons were still clickable when the project was already deleted. The whole process was actually super fast. It took one day. After the contributor found it, they described problem, and showed how to replicate it via a gif image. It was confirmed the same day, adding a “confirmed” label to it on git hub. Someone else fixed the issue and did a commit, and then the co-maintainer merged the commit.

Blender

GNU general public license seems to be very similar to the MIT license. When you distribute your software, you can do it for free, or for a fee. That being said, people who have your software have the same amount of rights you do and can modify and distribute that software.

Blender has many ways for you to contribute. They allow you to contribute through mailing lists, forums, a chat channel, and a bug tracker.

The problem I chose is the revision labeled D5204. This was about UI elements overlapping with each other when the window is scaled smaller. The contributor posted his findings to their bug tracker with pictures showing a possible fix. There were 3 reviewers and it seems that only one of them has to accept it in order for it to be implemented. This one took a bit longer (20 days) because there was a little confusion on how the UI is supposed to actually be displayed. Other than that, it seemed like a pretty smooth process with people communicating with each other.

Conclusion

Both of these programs seemed very efficient in their ability to deal with contributions. Blender seemed to have a bug tracker while Godot was pretty much exclusively on GitHub. Both of them seemed to be equally as good to me because they had everything in one place for revisions and reporting bugs. What I would personally have to learn in order to contribute is their preferred language and their code structure.

by cle18seneca at September 13, 2019 02:11 AM


Timothy Morris

MicroNote: a web-based note-taking app

MicroNote is a small web app that handles the simple task of note-taking. Of course, web-based note-taking apps can already be found on the web but what makes this one unique is how easy and lightweight it is. The user can easily type up whatever they have in mind, close the tab, and move on with their day without having to worry. The app automatically saves everything so when you get back on, your notes will be there waiting to be read.

Screenshot of the MicroNote web app

I specifically made some design choices to help bring out the Note aesthetic more. I’ve changed the background of the app to the exact color of a yellow post-it note ( #FFFF88), used the chilanka font from Google Font, and provided a thick black sharpie-like border around the text.

Working on this project has helped revitalize my interest in web development and I hope I can continue to play around with web programming in the future. If you would like to have a look at the code or help contribute to my project, please click here to check out my GitHub repository.

by Timothy Morris at September 13, 2019 01:47 AM

September 12, 2019


William Hovsepyan

Blog 1

Open Source Software 1: Mozilla Firefox Thunderbird

License: Mozilla Public License 2.0

Procedure for Accepting Patches: Contributor will view the list of bugs available for fixing. They will develop a patch for the bug, and once the bug has been fixed, it will be sent in for review using Phabricator . Once the reviewer responds to the sent in patch and approves it, the patch can be tested in Mozilla’s try server to check for any regressions. If successful the patch will be committed to the main branch.

Patch for Bug 1493158:

https://bugzilla.mozilla.org/show_bug.cgi?id=1493158

The bug that was resolved in this patch was an issue regarding a user trying to use Mozilla’s Thunderbird (Their free email application) and when they tried to fast click through the “To/Cc/Bcc” selector they would accidentally delete the recipient because of Mozilla’s auto complete features. This project resulted in a discussion from over a dozen contributors regarding quick temporary fixes, with frequent responses being sent, and officially closing the bug after 5 months.

Open Source Software 2: GIMP

License: GNU

Procedure for Accepting Patches: Contributors clones the latest git repository for GIMP, extract the source code, and make changes to their copy of the source code, then recompile and clean it. Then they generate their patch file and submit it via bugzilla. Once a GIMP developer reviews the patch and tests it to make sure there isn’t any regression they will apply the patch during the programs next version.

Patch for Bug 3886:

https://gitlab.gnome.org/GNOME/gimp/issues/3886

The bug presented in this issue is that when the user uses any of the “Select Tools” and clicks on the image they are using the screen blacks out instead of highlighting their desired sections. Three people discusses the issue and contributed possible solutions, the issue was resolved when one user referred to a similar bug which could fix the present bug in the same fashion. The interactions between users were frequent and resulted in the report being closed a day later.

Findings: These open source software both use similar processes for submitting patches and each are efficient in the way they review and apply their patches. In order to be able to submit patches that properly solve bugs I would have to learn how to review the issue in detail and understand their respective languages and how to apply them to generate a patch.

by whovsepyan at September 12, 2019 11:23 PM


Minuk Park

Simple Note Taking App

This is my very first open source project which is a simple web app to take notes. I designed the page using Bootstrap 4 to give it a modern look, and falling leaves are used as a background image to provide the mood of the current season.

Main features include:

  • A text box with a scrolling feature
  • A button to save the written text
  • A button to clear the text box
  • Once saved, the content remains in the text box even after refreshed

Links:

by mpark61 at September 12, 2019 09:40 PM


Reza Rajabi


A Simple Note-Taking App



nOTeTOn




If you are a kind of person who stuck on internet and surf pretty much all the time, or internet browsers are your best friends, well it makes life easier for you to have any app you need right on your browser, or online. That also makes you free from installing different applications and keep updating them.

The tendency of using the internet almost everywhere seems to lead us mostly using cloud-based or browser-based applications. That means maybe we are going to have/pay for less powerful and cheaper computer machines, and we are going to use our computers as dumb terminals.

If you are wondering how an on browser application might work, nOTeTOn is an open-source application that allows you to write down your notes right on a web page in your browser. So, essentially when you are using this kind of applications, you don't need to install anything on your system, and everything gets handled by your browser.

nOTeTOn uses different other open-source technologies to handle the note-taking, and It is hosted on GitHub Pages platform. It uses FilerJS Browser Filesystem library to persist your notes on the browser's memory and to read from. When you wrote down your note, it uses HotkeysJS to let you save your notes using a shortcut on your keyboard.

by RaRe (noreply@blogger.com) at September 12, 2019 09:35 PM


Paul Luu

Simple Whiteboard Application

Creating a simple whiteboard application

My whiteboard application is a basic application that saves the user’s input onto the whiteboard, keeping the input even after the user has close the session.

Git and GitHub

I’ve used Git and GitHub many times before, so pushing commits and cloning repositories is nothing new. What I did learn was how to setup GitHub’s hosting service, called GitHub page. This is a great way to test/debug your website, because GitHub page rebuilds/re-host after each push in your GitHub repository. This feature made it easier for me to develop my whiteboard application, and to test if there were any bugs in the application.

WHITEBOARD features

Filer

One of the features I use for my whiteboard application is Filer. Filer uses IndexedDB which is a client-side storage API that support most browsers. Using Filer allowed my application to save the user’s input and read any previous input if entered.

Vanilla CSS framework

Vanilla CSS Framework is a very simple CSS Framework compare to other CSS Frameworks. No heavy UI changes in the actual framework, but is very useful if you want to create your own CSS Framework using Vanilla CSS Framework as a clean foundation.

Hotkey.js

Hotkey.js allowed my application to use the shortcut CTRL+S to save the user’s input on the whiteboard. There are some extra steps you have to take if the shortcut revolves around ContentEditable but is a helpful JavaScript library if you need to use keyboard inputs for your websites.

LINKS:

Frameworks and libraries used in application:

by pluu3 at September 12, 2019 09:27 PM