Monday 8 December 2014

Project Release 0.4

In my project release 0.4, I still worked on the webmaker app project. I was working on the issue#569, which are the UI adjustments on Sign In. The code that I fixed is in webmaker-login-ux, which webmaker app uses for log in. My pull request is here. And the screenshot after fixing is as follows:


Friday 5 December 2014

Changes in Open Source in Last 3 Months

In this semester, I had the opportunity to take David Humphrey’s OSD600. In this course, I learned the culture of open source community and how to involve in the development of an open source project. Open source model becomes more and more popular. And a lot of companies have open-sourced the software. Although, it’s been only three months since I started learning open source development. The changes in the open source community are large and obvious.

In this October, the 13th FSOSS conference was held in Seneca@York campus. I participated as a volunteer. There were more than 200 registered audience, nearly a hundred more than the number in last year. From the number of FSOSS participants, we can see there are more and more people interested in the open source.

Moreover, the biggest news in open source community during last three month was that Microsoft announced that it made the full .NET server core stack open source for cross-platform Nov. 12, 2014. Developers can begin engaging with breadth of .NET open source project at Github. It uses MIT License, which is one of most popular license in open source projects, instead of its own open source license in the dotnet project.  That was the big step for Microsoft in the open source community. It is also a big sign that open source is getting widely recognized and adopted as an efficiency development model and in the software development industry since Microsoft, the top company leads the development model in the industry always, starts moving steps into the open source community. It is anticipant that there will be more and more companies and developers will participate the open source community.


Source: 



Wednesday 26 November 2014

Building Open Source Browser – Firefox on Windows

I followed the instruction to build Firefox in my laptop, which is x64 system, using OS Windows8.1.

First of all, check the prerequisites. 
Check if all of windows build prerequisites are installed in the computer. At this point, I have to install MozillaBuild package. I downloaded and installed the latest version of MozillaBuild in fold c:\mozilla-build.

Second, get the source code.
Mozillar use Mercurial repository to hold the source code.
To get the source code, I have to have Mercurial installed in my laptop. I downloaded and installed TortoiseHg, which a Windows shell extension and a series of applications for the Mercurial distributed revision control system, similar with TortoiseGit and TortoiseSVN. It saves from getting lost in the instruction of Windows Install on mercurial website.

Next, start the building environment.
In folder c:\mozilla-build, type start-shell-msvc2013.bat to setup building environment because I have install visual studio 2013 installed in laptop. Then it enters a linux mode in window power shell.
Running start-shell-msvc2013-x64.bat generated the error in building (4:21.90 configure: error: You are targeting i386 but using the 64-bit compiler).

Following, build the project.
cd into mozilla-central subdirectory in above powder shell, and run command ./mach build. It will take some time to build the project. It takes 3 to 4 hours to build the project. In the end, it will show a success message if the build finishes and succeeds as follows:



Finally, run the project

Run command ./mach run in the same fold as above. Firefox Nightly browser will be started as follows:


Friday 21 November 2014

Grunt vs. Gulp

Grunt and Gulp are the popular task runner in Node.js projects. In release 0.1, I have used Grunt in Filer project. And webmaker project uses Gulp indead. I did some research on their similarities and differences.

Both Grunt and Gulp are to build the process in Node.js base. But they have different mechanism. Grunt has longer history and Gulp is new.

Plug-ins:
Both Grunt and Gulp relies on the plug-ins to build tasks. They have large plug-in base. Developers rarely need to developer own building tasks. Grunt has better community support than Gulp since it has longer history. Grunt plug-ins often perform multiple tasks; Gulp plug-ins are designed to do one thing only.  

Mechanism in building process:
Grunt needs to generate intermediary files (.tmp/) to disk during the building process. It uses declarative approach to build tasks. When the build flow is large, it will be hard to figure out the task execution order. Also, the development team needs to write the maintenance code.
Gulp is a streaming building system. Streams is the most important concept of Gulp, which means that you input your files into a pipe from one end and generate the output file from the other end without any interruptions in the middle of the process. It makes your task definitions a bit easier to ready. And it does not have the disk I/O issues since it does not have the intermediary file written to the disk. However, Gulp requires developers know Node well to deal with streams, pipes and asynchronous code.

Gruntfile.js vs. Gulpfile.js
Grunt uses JSON-like data configuration files. And Gulp use Javascript code. There are examples getting from Filer project and Webmaker project.

Gruntfile.js

 Gulpfile.js
Both of them have advantages and disadvantages. Developers would consider them to choose the best suitable one. As a beginner in open source community, it is good to learn both of them to help understand the system I am working on.

Source:



Thursday 20 November 2014

Release 0.3

I chose to stay in webmaker project for my release 0.3 project since I have worked on this before and am interested in this project. I picked up the issue #498 and then worked on it for several days. I noticed that this project uses page.js to direct routing. It took me some time to understand how page.js works, but finally found out page.js does not have the functionality to refresh the page. Then I used location.reload() to do so. After doing release 0.3, I got to know more about webmaker My pull request is here

Wednesday 19 November 2014

Strategies benefiting from open source communities

On OSD600 class on this Monday, we had a discussion on how to build a software production pipeline that can strategically benefit from a vibrant open source community from many aspects, such as big corporations, small shops, students and so on.

We had a lot of ideas, which can be categorized into following aspects:
  • Face to face gatherings: since the open source developers are from all of the world, it’s important and excited for them to have chances to gather together and have the face to face communication, such conferences, workshops and so on. They can increase participants’ enthusiasm to the open source community.
  • Standards: good standards make participants easy to understand and follow, and keep workflow organized in open source communities.
  • Technology: using programming languages that is newly developed.
  • Onboarding: making it easier to understand for non-developer.
  • Time management: making miles stones.
  • Project planning: doing marketing research to find users and localization staff, use feedback to improve the project.
  • Funding: big companies would sponsor for events held in open source community; hiring contributors.
  • Partner : encouraging partnerships with business and educational organization, partnering with educational organization to have more targeting users and participants for the project
  • Building open community: encouraging social media, use permissive license; putting on version control system, such as github or subvision; recognizing contributors, mentoring the community.
  • Documentation: creating good guide and documentations for new developers, making video/audio guide for different learners.



Monday 10 November 2014

Less.js – a CSS preprocessor

Today, Jordan Theriault introduced Less.js in the OSD600 class. Less.js gets popular recently. It is a CSS framework working with Javascript in client-side. I started to learn and use it when I worked Mobile Webmaker project.

Less.js have some advantages:
  • Improve performance. The purpose of Less.js is to speed up development of CSS. So using Less.js can improve performance in ways that can’t be done in normal CSS.
  • Significantly reduce sizes of style sheet files by well grouping things. Using Less.js, .css files can be well grouped and be separated into smaller and more meaningful .less files.
  • Easiness to operate. Less.js has following features:

·         Ability to define variables,
·         Operations and functions (Mathematical functions and operational functions)
·         Mixins, embedding all the properties of a class into another class
·         Nesting
·         Joining of multiple files.

Those features of Less.js make it easy to operate to group things and generate CSS files. Moreover, the developers are easy to modify .less files with those features by reducing the redundancy of the code.

In the future, I will dig deeper into Less.js with continuously working in Mobile Webmaker project.


Source:

Monday 3 November 2014

Presentation Script – NodeJS

This presentation contains following content:

´  What is Node.js?
´  Popularity
´  License
´  History
´  Community
´  Main idea of Node.js
´  How to start

What is Node.js?
In nodejs.org, Node.js is described as follows:
Node.js® is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

This is what is Node.js on Wikipedia:
Node.js is a cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows and Linux with no changes.

Popularity
Node.js is release under the MIT license and bundles other liberally licensed OSS components, such as V8’s license, OpenSSL’s license, HTTP Parser’s license, npm’s license and other licenses for some modules / tools.

License

History
Node.js was created by Ryan Dahl (github: https://github.com/ry), starting in 2009.

Its development and maintenance was sponsored by Joyent, the firm where Dahl worked.

Dahl stepped aside in 2012. And Timothy J Fontaine (twitter: https://twitter.com/tjfontaine, github: https://github.com/tjfontaine) is Node.js’ current project lead


Community

Contribution Guide (http://nodejs.org/documentation/contributing/). It contains the instruction on reporting an issue and contributing a feature or fix, such as how to fork, branch, commit, test, push and so on.

nodejs.org in multiple language: http://nodejs.org/documentation/localization/


Main Idea of NodeJS
Use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices.

Non-blocking / callback means that the code does not need to wait the completion of the action to continuously execute the next line.

Event-driven means that Node.js uses even loop to handle tens of thousands of concurrent connections instead of multiple threads.


How to Start 
Tutorials


Source:
Real Time Web with Node.js (http://node.codeschool.com/levels/1)



FSOSS in Oct 23-24, 2014

This year’s FSOSS at Seneca College, Toronto was the thirteen iteration. Three keynote speakers were invited to this year’s conference. . They are David Humphrey (CDOT Researcher for Mozilla Foundation), Bob Young (Red Hat, Inc. Co-Founder) and Chris Aniszczyk (Head of Open Source at Twitter). And thirty-five speaker have presented at the conference. I participated this event as a volunteer. Fortunately, I listened two keynote speakers’ presentation and the Kieran Sedgwick’s presentation besides my duty shift.

All of the three presentations expressed speakers’ enthusiasm to the open source. Mr. Young generally introduced how open source work with business from the entrepreneur aspect. Mr. Chris talked more details on open source on technical side. With more experience and profound understanding on open source, He clearly shows the craft and culture of open source and presents how open source works in a large scale a company (Twitter). He explicitly expresses he loves open source and gets a lot of advantages from it. Moreover, he hopes there are more and more people joining open source development.


Mr. Kieren is an intermediate open source developer, who works in CDOT, an open source organization. In his presentation, he did not explicitly mention his view point on open source. But from his words, audience can strongly receive the message that he has a very positive opinion on open source. He starts his career at an open source organization with the open source projects. He learns cutting edge technologies and grows rapidly in the open source environment. He gets many benefits from open source community. In his presentation, he uses an open source project to illustrate how the mentioned technologies work. It is inevitably showing audience how open source works in a small scale - a project from some aspect.   

I am glad I did contribution to the big event held by CDOT at Seneca College. And I had deeper understanding on open source from this conference.

Friday 17 October 2014

OSD600: Release 0.2

I took issue#319 in Webmaker for this release. I already completed it. Please find it here

This issue is about the UI, to align the line on the homepage with the text instead of centralize it. 

Now it looks as following:



Wednesday 15 October 2014

OSD600: Release 0.2 – Webmaker – issue#319

In project release 0.2, I would like to take the issue #319 in webmaker. And I already left a message on github to ask and am still waiting for the response. This issue is about the UI, making the line to align with the text in the homepage. It is a small bug and easy to fix. However, it will a good start for me to go through the whole project and get the ideas about how it works. Whenever I get confirmed, I will send the pull request to make my first contribution on a real open source project. 

I have been hesitating in taking bugs for a while. Inspired by David's article "Minimum Viable Product" in Oct. 8, I decide to start with small bugs. Taking a small bug makes me feel more confident on open source development. And I am willing to take more bugs. 

Also, there is another small bug (#315) I am interested in. After I am done with this, I am most likely to work on that if it’s still available.

Monday 6 October 2014

OSD600: Project for Release 0.2

Kate Hudson introduced Mobile Webmaker project in last Wednesday. It is a mobile application providing users the framework to create the mobile apps. In other words, it is a software being used to create software. She also showed some examples and gave the links of how to start. This is a cool project, which also have the clear information to start.

Moreover, I have some friend who are going to work on this project as well. Thus, I can discuss with them. And we may help each other although we work on different issues.

I need to look at the issues in detail and then decide which one to take. I will do so no later than this Wednesday, and will post which issue I would like to take.


SPO600: Lab3 - Loop in Assembly

In lab3, we were asked to write the assembly programs in both x86_64 and aarch64 to display number 0-29 in a loop.

This was my first assembly code. And it took me one night and 2 whole days to get them work. Now the loop is working to display the numbers. But I still have the problem for the newlines. My outputs do not have the newlines as I expect.  In other words, my output is on one line. I spent some time on this issue, but have not found the solution.

One frustrating thing in assembly is that different platform requires different syntax. The code I run in one platform without problems could not smoothly transform to the other platform. I still need to spend amount of time to recode it even though both programs have the same logic and same output.


Here is the code on X86_64 in GAS syntax.

 .text  
 .globl _start  
 start = 0  
 max = 30  
 _start:  
     mov  $start,%r15       /* starting value for the loop index*/  
 loop:  
     /*showing digit*/  
     mov   $'0',%r14  
     mov   $10,%r13  
     mov   $0,%rdx  
     mov   %r15,%rax  
     div   %r13  
     cmp   $0,%rax  
     je   singledigit  
     mov   %rax,%r13        /*store the second digit from right*/  
     add   %r14,%r13  
     mov   %r13,msg+5  
 singledigit:  
     mov   %rdx,%r12  
     add   %r14,%r12  
     mov   %r12,msg+6  
     /*showing loop in front of digit*/  
     mov   $len,%rdx  
     mov   $msg,%rsi  
     mov   $1,%rdi  
     mov   $1,%rax  
     syscall  
     inc   %r15              /* increment index*/  
     cmp   $max,%r15            /* see if we're done */  
     jne   loop              /* loop if we're not */  
     movq  $0,%rdi             /* exit status */  
     movq  $60,%rax            /* syscall sys_exit */  
     syscall  
 .data  
 msg:  .ascii   "loop:  '\n'"  
 .set len, . - msg  

And ARM assembly in aarch64:
 .text  
 .global _start  
 _start:  
     start = 0  
     max = 30  
     mov   x15,start        /*starting value for the loop index*/  
 loop:  
     mov   x28,0  
     mov   x27,10  
     adr   x12,msg         /*loading the message*/  
     udiv  x10,x15,x27       /*getting the quotient*/  
     msub  x9,x10,x27,x15     /*getting the reminder*/  
     cmp   x10,0          /*if quotient equals 0, then go to execute single digit*/  
     beq   singledigit  
     add   x14,x10,0x30      /*display quotient - second digit from right*/  
     str   x14,[x12,6]  
 singledigit:  
     add   x11,x9,0x30       /*display reminder - first digit from right*/  
     str   x11,[x12,7]  
     /*system call write*/  
     mov   x1,x12  
     mov   x2,len  
     mov   x0,1  
     mov   x8,64  
     svc   0  
     /*loop*/  
     add   x15,x15,1  
     cmp   x15,max  
     blt   loop  
     /*system exit*/  
     mov   x0,0  
     mov   x8,93  
     svc   0  
 .data  
 msg:  .ascii  "loop: ##\n\r"  
 len=  . - msg  

Through the practice in this lab, I got the basic idea how assembly works with memory and register, how to do the system call and how loop works.


In the end, I would like to ask if anyone has any good tutorials in assembly for beginners or suggestions, please comment it because I could not find one good for beginners. I highly appreciate.   

Thursday 25 September 2014

OSD600: Release 0.1

I have done the project 0.1 release and send David the pull request (https://github.com/humphd/filer/pull/5)  today. Project 0.1 release was to add the du command to filer project. Following project instruction, I did not have much difficulties to finish it.
First of all, I got the code and had my github ready by forking filer to my github account and coloning it to my local computer.

Then I installed the node.js in order to have npm package installer in my computer.

Next, following the instruction to install the grunt both locally in project (filer) folder and globally in my computer. At this step, I had the trouble to install grunt locally with the errors during the installation. After discuss with the classmate, I found out that I need use Linux command line instead of Windows command line to run the command “npm install”. Then I used git bash to run this command, and it turned out that installation was successful eventually.

Following, I run “grunt test” to test the code. I met the problems as well here. After asking David, it was resolved by updating to the latest code. The problem I met was just solved and updated quite recently, and I had not updated my code yet.

At this point, I had all the required environment ready. Then I started to write the code. I reviewed the code for cat command and ls command because du command has the similarity with these two commands. Both du and cat commands have two parameters – data and callback. And both du and ls commands need to return deep content of a directory tree, and have the file size, file path and file content. Having the reference to these two blocks of code, I built du command without much difficulties. There were 5 files that needed to be modified and/or added. They were:
  •        MODIFY: /README.md
  •        MODIFY: /test/index.js
  •        MODIFY: /src/shell/shell.js
  •        MODIFY: /dist/filer.js
  •        ADD: /test/spec/shell/du.spec.js

At last, it passed the test with no error. 

Tuesday 23 September 2014

SPO600: Static linking vs. Dynamic linking

Linker as a system program takes relocatable object files and command line arguments in order to generate an executable object file. The linker is responsible for locating individual parts of the object files in the executable image, ensuring that all the required code and data is available to the image and any addresses required are handled correctly.




Static and dynamic linking are two processes of collecting and combining multiple object files in order to create a single executable. 

Static linking is the process of copying all library modules used in the program into the final executable image. This is performed by the linker and it is done as the last step of the compilation process.

During dynamic linking the name of the shared library is placed in the final executable file while the actual linking takes place at run time when both executable file and library are placed in the memory.

Differences between Static linking and Dynamic linking:

Static linking
Dynamic linking
Sharing external program
External called program cannot be shared. It requires duplicate copies of programs in memory.
Dynamic linking lets several programs use a single copy of an executable module.
File size
Statically linked files are significantly larger in size because external programs are built into the executable files.
Dynamic linking significantly reduces the size of executable programs because it uses only one copy of shared library
Easiness to update
In static linking if any of the external programs has changed then they have to be recompiled and re-linked again else the changes won't reflect in existing executable file.
In dynamic linking individual shared modules and bug fixes can be updated and recompiled.
Speed
Programs that use statically-linked libraries are usually faster than those that use shared libraries.
Programs that use shared libraries are usually slower than those that use statically-linked libraries.
Compati-bility
In statically-linked programs, all code is contained in a single executable module. Therefore, they never run into compatibility issues.
Dynamically linked programs are dependent on having a compatible library. If a library is changed, applications might have to be reworked to be made compatible with the new version of the library.

Advantages:

Static linking
Dynamic linking
      Static linking is efficient at run time.
      It has less system calls.
      Static linking can make binaries easier to distribute to diverse user environment.
      It let the code run in very limited environments.
      Dynamic linking is more flexible.
      It is more efficient in resource utilization, taking less memory space, cache space and disk space.
      It is easy to update and fix the bugs.
Static linking
Dynamic linking
Source:




Friday 19 September 2014

SPO600: Lab2

Brief description: 
Wrote a simple c program to display “Hello World!”, and  compiled it using command “gcc –g –O0 – fno-builtin”. Then using command “objdump” with options –f, -d, -s, --source to display the information of the output file.
And then do the following changes to see the changes and difference in the results.

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

Original output file: a.out
Output file after change: hello_all5.out

Before change:
When run the command: 

It only has main section for the source code:


After change
When run the command: 
It shows following:



6) Remove -O0 and add -O3 to the gcc options. Note and explain the difference in the compiled code.
-O3 is to optimize more for code size and execution time. It reduces the execution time, but increase the memory usage and compile time.

Output file before change: hello_all5.out
Output file after change: hello_all6.out

I use “time” command to check the execution time of above files, and get following result.


hello_all6.out is complied with the option –O3. It supposes to have less execution time. However, it takes much longer in real time than the previous one. Well, it does take less time in sys time.

I also compared the sizes of the output files with –O0 and –O3. The hello_all5.out, which is compiled with –O0, has smaller size than hell0_all6.out, being compiled with –O3. Apparently, compiling file with option –O3 does not reduce the file size. Instead, it increases the file size.


Following sreenshots are the result by running “objdump –source” command for both of the files.

Comparing the two results, I found:
1       --- The sequences of <main> section and <output> section in both results are different. For the output file hello_all5.out, being compiled with –O0 option, <main> section appears after <frame-dummy> section. And <output> section is after <main> section. By contrast, for the output file hello_all6.out, being compiled with –O3 option, <main> section appears right after the line “ Disassembly of section .text”. And <output> section still appears after <frame-dummy> section.

2   ---The contents of <main> section and <output> section are different for both results. For the output file hello_all6.out, the contents of both <main> section and <output> section are shorter than those in the result of hello_all5.out. It has 6 actions in <main> section of hello_all5.out and 9 actions in <output> section of hello_all5.out. By contrast, there are only 3 actions in <main> section of hello_all6.out and 4 actions in <output> section of hello_all6.out.











When I ran “objdump –s” for both files, I found more differences.
Contents of section .debug_line and contents of section .debug_str are shorter than the result of hello_all6.out. Moreover, the result generate by hello_all6.out has one more section – contents of section .debug_ranges.
Contents of section. debug_str generated by hello_all5.out

It is good to know that using different compiling options, the compiler compiles the program in different ways. Each option serves the different purposes. Accordingly, the assembler contents of each object files are different as well.

Using “objdump” command, it is good to see the assembler contents of the object file. It’s a good start to learn the assembly language. However, I still don’t fully understand what the assembler contents stand for. With learning more assembly language, I think it won’t be a problem for me anymore.