Planet CDOT

October 20, 2014


Gideon Thomas

My first contribution to Webmaker App…

Hey everyone,

So I’m a little late in writing my blog and I apologize for my horrible time management.

I was working on the bug I planned on for release 0.2 in my open source class. Turns out, it was easier than I thought it would be.

The issue basically was to write tests that would make sure that the file that contains app templates as simple JSON data is in fact valid JSON and confines to a proper format. One of the contributors even suggested an excellent library, tv4 for getting this done. Luckily, my previous experience with JSON schemas proved to be very helpful. However, even though I had experience with schemas before, I often found myself referencing the JSON schema docs for refreshers.

I began by doing some prep work which included installing the library and going through their docs, writing the basic skeleton for my tests and determining what my tests would be. I ended up coming up with two tests in mind – one that makes sure that everything in that JSON file has the necessary properties that templates need along with some simple data type validation, format validation, etc.; as for my second test, it basically checked to make sure that every template name was localized, i.e. was present as a key in another JSON file.

I began writing the schema piece by piece. Building it based on a breadth first approach. This meant that I would first, exam the outermost object, create a ‘shallow’ schema for each property with simple checks. If a property was an object, I would basically assign a variable that would later be defined to hold the schema, to that property’s schema. In that way, I created the outermost objects schema. However, if I ran the test, it wouldn’t work as there were several references to variables that did not exist. These were the variables that I was going to create next that would hold the schemas for the properties that were objects. I kept using this approach until I was completely done writing the schema. After running the test a few times, couple of small bug fixes and voila…my first test was finished.

The second one needed some thinking. I had to do something tricky to only validate one property of each object, viz. the name. I had to create the schema skeleton for the JSON object and effectively provide ‘empty’ validation for the properties that I did not care about. Then, I was able to provide a custom validation for the name by checking whether it was in the localization file (the tv4 docs allowed me to provide my own validation function…yay)!

I submitted my PR on Saturday very very early in the morning (like at 2am). Unfortunately, by the time I came to write this blog post, it was already merged into the main repo…whoops :P


by Gideon Thomas at October 20, 2014 11:31 PM


Gary Deng

OSD600 Project 0.2 Release

Mozilla-Appmaker is a tool that helps anyone, not just developers, create mobile applications. Appmaker apps are composed of web components, custom/resusable HTML tags, connected with events and listeners.

In my Open Source Development course project release 0.2, I chose to work on the mozilla-appmaker issue#2253. At the very beginning, I had difficulty to set up my development environment, hopefully, people in the appmaker community are always very helpful. Thanks for all the help from #appmaker IRC channel and my CDOT colleagues.The following contents will briefly introduce how I accomplish this task:

  • Pick bug to work: Go through all the issues in the list, read the comments and ask questions to make sure I can work on the issue
  • Try to play with the appmaker in my local machine in order to reproduce the bug
  • Use my browser debug tools to find out which files I should look into, in this case, the file is “ceci-channel-menu.html”
  • Learn some basic knowledge about Polymer element so that I can understand the logic of original source code
  • Learn the Element Interface, this is completely new to be. For example, I have never heard about Element.shadowRoot before.
  • Finally, fix the issue and test it to make sure I am able to get desired result, then send my pull request to mozilla-appmaker:develop branch

Test Result:

1. There are 3 listener channels for a counter
Capture1
2. After channel C is disabled
Capture2
3. After channel A is disabled
Capture3
4. After all channels are disalbed
Capture5


by garybbb at October 20, 2014 05:23 AM


Brendan Donald Henderson

Fedora Packages: Further Inspection

This post builds on the content of my previous post by taking a more in-depth look into a few of the packages that were already discussed.

The following is a package-by-package analysis to determine where assembly existed, either in the form of assembly source files, or embedded assembly in higher-level language source files.

php-pecl-apcu:

  • No assembly files(.s/.S)
  • Files with embedded(inline) asm:
    • pgsql_s_lock.c: Contains assembly code for test and set operations if spinlocks are enabled. This assembly only pertains to rare conditions: being on a sun3(sun-microsystems) system, or being on a motorola 68K processor not running linux.
      • pgsql_s_lock.h: contains a HUGE amount of assembly for many different architectures(some that would arguably no longer be used except for nostalgic purposes) all with the purpose of implementing test-and-set spin locks(lock and unlock). There is assembly for ARM, but I believe it’s only for 32-bit ARM platforms. I would be truly astounded if this assembly is still valid as a “performance optimization” over what gcc could offer. There is also detection code for different compilers such as Intel’s c/c++ compiler if ia64 arch. Presumably this is because those compilers provide non-assembly solutions?? The fallback to no system-dependent implementation being used is SysV semaphores(in spin.c) which are pre-POSIX semaphores. But I strongly believe that gcc intrinsic functions could provide not only a more portable but also better performing solution.

mpfr:

  • No assembly files(.s/.S)
  • Files with embedded(inline) asm:
    • src/mpfr-longlong.h:
      • Notes mention: inline asm macros(There are C macro fallbacks for unspecified architectures)
      • Notes also mention: The use of newer gcc built-ins(from newer gcc releases) and the fallback for older gcc versions is either ‘generic c'(assuming ANSI standard) or and inline asm block.
      • Not very obvious when built-ins v.s. inline asm blocks are preferred but seems like on certain gcc/architecture combinations(probably more recent ones with optimized built-ins) that optimized built-ins are known to exist and thus used where if they are known to not exist at that time then inline asm is used.
      • Because of this it seems like porting to aarch64 could already be possible as the only versions of gcc that will exist on aarch64 would be recent ones with the preferred gcc built-ins. May just need to add a #ifdef for aarch64.
        • There is already a lot of inline asm for arm32 and extra performance asm for something called ARM M series?
    • No inline asm in the c source(implementation) files

llvm: For this particular package I was brief in my analysis of some of the asm found as there was quite a bit and it was scattered all over the package and I was looking in a very indiscriminate way.

  • Found irrelevant asm:
    • src/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h: a single block of asm to set the default add operation on none intel ia64 architectures, the entire directory seems intel specific so probably no reason to bother with arm here.
    • src/lib/support/Unix/Memory.inc: 3 very short inline assembly blocks for PowerPC arch, arch and other platforms have c code, not sure if this is relevant to performance.
  • Found Asm:
    • src/lib/Support/Host.cpp: contains several multi-line asm blocks all focused on cpuid for various x86 archs both 32 and 64-bit.
    • src/lib/Target/ARM/ARMJITInfo.cpp: A single asm block, implemented for 32-bit ARM archs, that seems to be used to overrides how gcc typically handles the stack during a procedure call?
    • src/lib/Target/Mips/MipsJITInfo.cpp: single asm block to implement JIT compilation callback as gcc doesn’t properly handle the prologue/epilogue.
    • src/lib/Target/PowerPC/PPCJITInfo.cpp: single asm block to implement JIT compilation callback as gcc doesn’t properly handle the prologue/epilogue.
    • src/lib/Target/Sparc/SparcJITInfo.cpp: single asm block to implement JIT compilation callback as gcc doesn’t properly handle the prologue/epilogue.
    • src/lib/Target/X86/X86JITInfo.cpp: single asm block to implement JIT compilation callback as gcc doesn’t properly handle the prologue/epilogue.
    • src/lib/Target/X86/X86Subtarget.cpp: a simgle asm block that is used to check the OS’s AVX support if the toolchain is gcc and the arch is one of the major Intel/AMD x86 releases.
  • More asm that I did not have time to analyze:
    • A lot of assembly source files(.s/.S) in:
      • src/test/*various archs*
      • src/test/Object
      • src/test/CodeGen
      • src/test/DebugInfo
      • src/tools/clang/test/Driver
      • src/projects/compiler-rt/lib/*various archs*
    • A lot of embedded asm in:
      • src/tools
      • src/projects
  • Note: Seems to be asm used frequently for JIT compilation callback implementation as gcc doesn’t meet requirements!

Future Work:

These packages are ones that I have found interesting and will be doing further investigation to determine whether it is feasible to complete work on them within a few months time. They are all from the LPC Code Module List, and I will include the notes from there below. I will be explaining any asm(files or embedded in source code) found in these packages in my next post.

  • pyrit: This is a cryptographic hash cracking tool. It apparently uses x86 asm for performance with a C fallback. This isn’t surprising as cryptographic hashing is a very expensive arithmetic operation and on many x86 processors, especially more recent ones, there are special instructions and hardware to speed up operations related to cryptographic hashing.
  • john(the ripper): This is another(very infamous) cryptographic hash cracking tool that apparently has completely asm version of the crypto functions. Again this makes sense due to the expensive nature of the necessary operations.
  • cryptopp: C++ class library for cryptographic schemes. Apparently includes asm for performance in crypto and checksum code(not sure which specific asm, probably some x86).
  • polarssl: is a lightweight crypto and SSL/TLS library. It apparently includes assembly in quite a few places:
    • x86 asm for low level driver support(via padlock)
    • timer access on various archs
    • bignum maths on various archs(including arm 32-bit) and has C fallback

by paraCr4ck at October 20, 2014 03:59 AM

October 18, 2014


Linpei Fan

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:



by Lily Fan (noreply@blogger.com) at October 18, 2014 04:59 AM


Yasmin Benatti

Release 0.2

I changed my second release to a project with no programming language, due to the fact that I just finish my first year.

Once I know two languages and Webmaker need translations, I’m working on Transifex and I translated some of the stuff that were missing for them. It is a very nice project, I’m getting in touch with the project and Open Source still and I’m also training my English/Portuguese skills.

That was a very nice opportunity that David offered me. It fits perfectly to what I’m able to do and I can still attend the classes.

Cheers!

by yasminbenatti at October 18, 2014 01:15 AM


Ava Dacayo

My first contribution – Mozilla Webmaker App

As a refresher, here is a link to the issue in GitHub I picked for Release 0.2.

Here’s how I tackled it:

  1. Inside the issue description in GitHub was the link to the document on how to localize views in Webmaker Mobile as well the details of how I can see the page and where the codes are.
  2. Seeing actual codes, for me at least, is different from just reading the documentation. So I looked for an actual implementation within other files by going to the original repo and searched up i18n. I also checked which files I need to change.
  3. Updated index.html and locale\en_US\mobile-appmaker.json to enable localization. Saved.
  4. Gulp dev — NOTHING HAPPENED!

Did I do something wrong?!  Why aren’t the texts changing? Do I need additional files? Is it really being translated? I changed the English translation to gibberish and the changes still did not get reflected.

So what’s happening?

I copy pasted the exact working code and replaced it with the keyname I want to use. I tested it by putting back gibberish again and typed the gulp dev command. SUCCESS!!! Apparently, I typed in il8n instead of i18n. LOL. I tested it by confirming that first, the texts will change if I modify the mobile-appmaker.json US-English file. Second, I updated the French mobile-appmaker.json file using the same keys I used and checked if it translates when I add the ?locale=fr in the address bar and back to english when I type ?locale=en_US which it did.

So I’m ready to go! Almost at the exact moment I pushed a commit which referenced the issue number, k88hudson commented asking if I could get a patch up because they need it next week for Mozfest. (I was gonna say I’m psychic but she beat me to it saying “WOW ESP”). I had to change some of the descriptions based on her instructions and pushed again… And then she replied that it looks like I need to rebase. I remember “rebase vs merge” during class but I’ve never tried rebasing before. So I quickly googled how to do it, but I didn’t get lucky in executing it. In the end I think I unintentionally did a merge while attempting to rebase because I was trying some commands. I was expecting them to get back to me and suggest how to do it properly, but when I looked, thisandagain merged my commits into mozillafordevelopment:master.

Hurrah!!!!!!!!

Now I’m more comfortable with the process and really excited for the next task!

pull request

Oh and I got a rainbow colored .gif from thisandagain.

Can’t describe it so here is a link : https://github.com/mozillafordevelopment/webmaker-app/pull/354#issuecomment-59563677


by eyvadac at October 18, 2014 12:13 AM

October 17, 2014


Andrew Smith

How to stop using webfonts from Google without breaking your wordpress theme

I finally had enough of the old theme on this blog. I would have kept it but with WordPress 4 the fonts looked even smaller than they did before. I tried to fix it but found so many problems (starting withe a default font size set to 62.5%) that decided replacing it entirely will be easier. It was.

The nice new bootstrap-based, mobile-friendly theme installed without much trouble, except for one annoying issue. I turned on Firebug to see how long it takes to load and found more than 10 calls to google.com and gstatic.com. Not cool.

GrumbleGoogleFonts

Notice also how much extra time it takes to finish loading the page just because of those bloody fonts on a server I don’t control. Where are the requests coming from?

cd wp-content/themes/cara # (or whatever your theme name)

includes/tamatebako.php: * return clean and ready to use google open sans font url
includes/tamatebako.php:function tamatebako_google_open_sans_font_url(){
includes/tamatebako.php:        $font_url = add_query_arg( 'family', 'Open+Sans:' . urlencode( '400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' ), "//fonts.googleapis.com/css" );
includes/tamatebako.php: * return clean and ready to use google merriweather font url
includes/tamatebako.php:function tamatebako_google_merriweather_font_url(){
includes/tamatebako.php:        $font_url = add_query_arg( 'family', urlencode( 'Merriweather:400,300italic,300,400italic,700,700italic,900,900italic' ), "//fonts.googleapis.com/css" );
includes/tamatebako.php:         * @link https://developers.google.com/fonts/docs/webfont_loader
includes/tamatebako.php:         * @link http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js
includes/tamatebako.php:        wp_register_style( 'theme-open-sans-font', tamatebako_google_open_sans_font_url(), array(), tamatebako_theme_version(), 'all' );
includes/tamatebako.php:        wp_register_style( 'theme-merriweather-font', tamatebako_google_merriweather_font_url(), array(), tamatebako_theme_version(), 'all' );
js/webfontloader.min.js:
js/webfontloader.js:    var sa = "//fonts.googleapis.com/css";
js/webfontloader.js:    $.u.w.google = function(a, b) {

The problem is the theme is using webfontloader to load some (presumably nice) font from another server.

If you don’t like that (and you shouldn’t, unless you already use google analytics or other big brother system :)) here’s what you can do to avoid pinging another server for every query to yours:

Find where the font is actually used. In my case my theme is using TAMATEBAKO 1.2.2 (tamatebako.php) which asks for two fonts from fonts.googleapis.com: Open Sans and Merriweather.

Google says “All of the fonts are Open Source. This means that you are free to share your favorites with friends and colleagues.” Great, I will share them with myself by putting them on my server.

I could try to decode how this works in tamatebako.php:

add_query_arg( 'family', 'Open+Sans:' . urlencode( '400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' ), "//fonts.googleapis.com/css" );

but that would just give me an unnecessary headache. Instead I will look at the source for my blog page (or Firebug) to find:

http://fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=4.0

and

http://fonts.googleapis.com/css?family=Merriweather%3A400%2C300italic%2C300%2C400italic%2C700%2C700italic%2C900%2C900italic&ver=1.0.0

Ok, those are two CSS file I can download, referencing a bunch of .woff files I can also download. Clickedy click click click.. I now have:

$ ls -lh webfonts/
total 388K
-rw-r--r-- 1 andrew andrew  33K Oct 16 15:49 DXI1ORHCpsQm3Vp6mXoaTRa1RVmPjeKy21_GQJaLlJI.woff
-rw-r--r-- 1 andrew andrew  22K Oct 16 15:53 EYh7Vl4ywhowqULgRdYwIFrTzzUNIOd7dbe75kBQ0MM.woff
-rw-r--r-- 1 andrew andrew  22K Oct 16 15:53 EYh7Vl4ywhowqULgRdYwIG0Xvi9kvVpeKmlONF1xhUs.woff
-rw-r--r-- 1 andrew andrew  24K Oct 16 15:53 EYh7Vl4ywhowqULgRdYwIL0qgHI2SEqiJszC-CVc3gY.woff
-rw-r--r-- 1 andrew andrew  34K Oct 16 15:49 MTP_ySUJH_bn48VBG8sNSha1RVmPjeKy21_GQJaLlJI.woff
-rw-r--r-- 1 andrew andrew  32K Oct 16 15:50 PRmiXeptR36kaC0GEAetxmWeb5PoA5ztb49yLyUzH1A.woff
-rw-r--r-- 1 andrew andrew  32K Oct 16 15:49 PRmiXeptR36kaC0GEAetxrsuoFAk0leveMLeqYtnfAY.woff
-rw-r--r-- 1 andrew andrew  17K Oct 16 15:52 RFda8w1V0eDZheqfcyQ4EHhCUOGz7vYGh680lGh-uXM.woff
-rw-r--r-- 1 andrew andrew  22K Oct 16 15:53 So5lHxHT37p2SS4-t60SlHpumDtkw9GHrrDfd7ZnWpU.woff
-rw-r--r-- 1 andrew andrew  17K Oct 16 15:53 ZvcMqxEwPfh2qDWBPxn6ngi3Hume1-TKjJz2lX0jYjo.woff
-rw-r--r-- 1 andrew andrew  18K Oct 16 15:52 ZvcMqxEwPfh2qDWBPxn6nmFp2sMiApZm5Dx7NpSTOZk.woff
-rw-r--r-- 1 andrew andrew  18K Oct 16 15:53 ZvcMqxEwPfh2qDWBPxn6nnl4twXkwp3_u9ZoePkT564.woff
-rw-r--r-- 1 andrew andrew 2.1K Oct 16 15:52 merriweather.css
-rw-r--r-- 1 andrew andrew 1.6K Oct 16 15:49 opensans.css
-rw-r--r-- 1 andrew andrew  33K Oct 16 15:49 u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff
-rw-r--r-- 1 andrew andrew  32K Oct 16 15:50 xjAJXh38I15wypJXxuGMBtIh4imgI8P11RFo6YPCPC0.woff

388kB, eh? Wouldn’t have thought it adds up to that much, well that’s what happens when you use someone else’s web resource without thinking very much about it.

Now I put this webfonts directory of mine on my server, for example here: http://littlesvr.ca/grumble/wp-content/webfonts/ (I can protect it from external downloads if it becomes an issue, which it won’t). Replace the Google references inside the css files to my local server as well:

sed -i 's|http://fonts.gstatic.com/s/merriweather/v8/|http://littlesvr.ca/grumble/wp-content/webfonts/|g' merriweather.css
sed -i 's|(http://fonts.gstatic.com/s/opensans/v11/|http://littlesvr.ca/grumble/wp-content/webfonts/|g' opensans.css

And now I will replace the two calls to “add_query_arg(…)” with:

"http://littlesvr.ca/grumble/wp-content/webfonts/opensans.css" and "http://littlesvr.ca/grumble/wp-content/webfonts/merriweather.css"

Checking what Firebug says.. done! Oh wait, why is there still one call to
http://fonts.googleapis.com/css?family=Open+Sans…? Diggidy dig dig dig.. hm.. I think it’s a bug in the theme, one of the add_theme_support() args said “open-sans” instead of “theme-open-sans-font”. How the hell did I figure that out? I don’t even know but I think I might be good at this programming business :)

Now all done, perfect!

by Andrew Smith at October 17, 2014 07:14 PM


James Laverty

A 'bug' story: Part II

Hey everyone,

The Webmaker bug was a success! The biggest problem I encountered was definitely setting up the dev environment. I ran into several errors on different computers, most of the time it was with the npm install to get gulp up and running. After I overcame those obstacles, I ran into a weird one (another bug perhaps?) where after logging into the localized version of my project it would not log me in aka the gulp dev. I tried it on Chrome, then moved onto Nightly, both to no avail. I eventually created a new log in and BAM, success.

After that I talked to a few people and got some help on where to begin, xmatthewx on github suggested that I use the how to template to help put it together and a few other sources put me on the right track. I learned a little bit about JSON and eventually got a template put together.If you want, you can take a look at my pull request! This is my initial request, I plan on getting a little feedback and updating my patch after.

This is a fun process and I get to have communication with professionals, how exciting!

IRC was also an interesting experience, for the most part it's petty quiet, but it seems useful if you ask the right questions.

That's all for today,

Cheers,

James Laverty


by James L (noreply@blogger.com) at October 17, 2014 03:31 PM


Yoav Gurevich

0.2 Milestone Completed - My 1st Appmaker Pull Request is in!

First and foremost, the link to the PR - Fixed tray hover tooltip position offset #2317

As expected, this bug ended up being nothing short of an absolute blessing because the time it took to fix it was an iota of the amount of time it took to successfully set up my Appmaker development environment on my Windows 8 machine in order to be able to properly see and test my work.

In the beginning, besides the odd npm install error log emitting after attempting to download the required dependencies partially failed raising an eyebrow, it was relatively smooth sailing until needing to install and run MongoDB. The Appmaker documentation doesn't really let on much as far as the nitty gritty to my particular use case, save for showing the general link to the official website tutorial for installation and use steps. Those proved to be little more than useless in the end. I GUI-installed MongoDB just fine, but as soon as I opened up a command prompt to try and run it as per the instructions on the Appmaker README it would fail and often close the window altogether. When I managed to isolate the error it purported, it looked something like this:

********************************************************************
 ERROR: dbpath (\data\db\) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
********************************************************************

But much like Tweety Bird constantly reaffirming that it did, it did in fact see a pootie tat... I too clearly made a \data\db folder and later even set and assigned that location to the dbpath explicitly in the config file. After trying to make the most of my google-fu skills to find a step-by-step how-to on Windows related MongoDB installation and execution, I finally found the most relevant and comprehensive one titled Running MongoDB on Windows. If you follow this with a fine-tooth comb, you will be able to both start mongo on both the command prompt, and have it perpetually keep running as a local service via the service manager.

NOTE: For the love of all that is good and righteous in this world, the Service Controller (sc.exe) command you will try to run to create a local service out of MongoDB can ONLY be executed by the administrator account -- not your own custom user account, even if it has the "administrator" label/type. If you want to be extremely thorough, follow the steps mentioned in this answer article to the same problem for a different sc command.

--------------------------------------------------------------------------------------------------------------------------

Finally, the bug itself proved to be initially daunting, but with inspiration from a casual comment given to me in-class on Wednesday from a fellow student, once I managed to get the node app/server to run, the procedure I followed ended up being close to my original strategy with a few additions:

1) Open my Appmaker localhost browser instance.

2) Find the "tray hover tooltip" element as described in the bug. It wasn't called that, so after thinking about it, I actually just used my own vision to infer where its location on the DOM was by looking at the image posted on the issue site in Github and compared it with my Appmaker site. I know, it's horribly crass, but hey, it seems to have worked out this time...

3) I used the Chrome Developer Tools to try and inspect the element by hovering over it. This was where my biggest issue was - the tray hover tooltip only appears when you hover over the tray's inquiry icon. Because life was never meant to be this easy. After a bit of thought, I figure I might be able to pinpoint it in the source code by finding where the logic for its parent element was - a div with an ID named "showInfo".

4) In Atom, I initiated a global search for that particular string. I ended up finding it in a place I would never have guessed from past experience with css properties - an .html file. What? Fine, I'll indulge in new flavors. So I started parsing the rest of the file and ended up landing on this interesting looking property nugget:

floatingMoreInfoPopup.style.top = pos + 54 - (height/2) - offset + "px";

I'll be honest. I don't have any background context on the specifics of this statement. It looks more like Javascript than CSS so my assumption is that it's some sort of new library or framework for CSS injection that I'm not yet aware of, or something much more comprehensive and cool altogether. What I did see is the name of the property itself, which by the looks of it seemed like just about exactly what I was looking for. So I did what any Curious Carl would do at this point...

5) Start playing around with values, and see what changes. Turned out to be pretty much as easy as that. I changed the pixel value after the "pos" variable by 14 pixels and voila!

The original positioning:


My fix's positioning:


And for now, that's all she wrote ladies and gentlemen. Stay tuned for next week update on FSOSS!

by Yoav Gurevich (noreply@blogger.com) at October 17, 2014 05:26 AM


Andrew Li

Release 0.2

For the second release, I got the opportunity to collaborate with the Appmaker community to help fix issue #2235.

The community made me feel welcomed, I was given lots of background information about the bug as well as tips on where to look to get started.

1. Understanding the bug

2. Approaching the bug

3. Pushing changes to origin

4. Pull Request

Understanding the bug

When a button is pressed, the background changes giving feedback that the button is now in a “pressdown” state. Once the press is released, a “pressup” event gets triggered and the button changes back to the original color.

But the ‘pressup’ event never gets triggered when pressing a button that links to another card tab. Thus the button never changes back to the original state.

Approaching the bug

I started by looking into the suggestions and the links given like the pressdown and pressup functions in the button component.

I read up on how bricks are built to try to understand how the project is structured.

Then explored around to find out where things were and how things get triggered by using javascript alert functions combined with firebug and Chrome DevTools.

Pushing changes to origin

I followed this guide on submitting a pull request.

I also followed this guide on updating a forked repo to make sure my forked origin had the latest changes from upstream from Appmaker.

Pull Request

Pull request link.

October 17, 2014 12:00 AM

October 16, 2014


Jordan Theriault

Release 0.2

For release 0.2 I completed Issue #308 for Mobile Webmaker which is an implementation of checking to determine if a username is taken while signing up. From my previous blog post, I have changed the functionality to check as a user types.

Screen Shot 2014-10-16 at 7.31.50 PM

This issue was solved by using Vue’s functionality for listening inside an html element. Using the v-on directive listening for a key-up I am able to trigger a javascript function which uses a function in the Webmaker Authentication Client in order to determine if a username is taken or not then I display the result to the user in a less robotic way.

The pull request can be found here.

I also worked on implementing a map brick, however that will involve much more time to complete and is therefore for another release. Currently, the map is displaying correctly but the architecture for how the map brick should be implemented needs further work.

by JordanTheriault at October 16, 2014 11:32 PM


Glaser Lo

Install the latest version of Node.js on Ubuntu 14.04

Since I am using Elementary OS (Freya, based on Ubuntu 14.04) on my laptop, the Node.js version in repository is a bit old.  When I tried setting up Makedrive, I got something like this:

sh: 1: node_modules/.bin/bower: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

It’s kinda weird that it said “not found” while the file actually exists, but usually it is related to binary incompatibilities .  In order to fix it, we need to add a NodeSource repository:

curl -sL https://deb.nodesource.com/setup | sudo bash -

Then install Node.js

sudo apt-get install -y nodejs

Enjoy!

Source: Offical guide on github


by gklo at October 16, 2014 12:49 PM


Andrew Smith

Announcing Everyone’s Timetable

After more than a year of work I finally got this app into a stable, usable state and published it.

Everyone’s Timetable is an Android app to help people in a school share their timetable. It’s particularly useful for finding a professor’s timetable though I’ve discovered it’s actually quite a handy way to look at your own timetable as well.

The timetable data can come from the professors themselves but I’m not expecting every prof to use it, so one of the neatest features of the app is the timetables can be crowd sourced. meaning I can put in the timetables for people I hang out with (like John Selmys) and I don’t need to wait for them  to do it.

phone-home

If you’re a Seneca or Sheridan student or prof – please give the app a shot! If you’re from another school – please contact me so I can add it to the list!

by Andrew Smith at October 16, 2014 11:58 AM

Fritzing for FSOSS: Designing a PCB in Linux

Next week I’m going to the Free Software and Open Source Symposium. It’s always worth going, and especially so this year, there are several great speakers for sure and many more with potential.

One of the things running during the symposium is a Robots competition. My humble contribution to this competition is the design of the PCB – a printed circuit board to hold in place the ultrasonic sensors, connectors for the bumper switches and motors, and the resistors needed to make sure the sensors don’t fry the Raspberry Pi.

A very simple circuit, but the last time I made my own circuits I had to design them using pencil and paper and make them by painting my circuit on with oil-based paint, so it would protect the copper I wanted to keep as the acid dissolved the rest of it.

At Seneca we have a machine that will very precisely cut out the PCB for us. But that machine needs instructions and those instructions are created by software. At first I thought I’d never get to give that a shot because they suggest proprietary software on Windows but then John Selmys found that you can use Fritzing, and it can export into the same Etched Gerber RS-274X which the lab needs. Woo!

There was definitely a learning curve, but given that this is my first encounter with this kind of software, I’m quite happy with the results. It took 6 tries but finally I got the design right. Here it is, a double-sided PCB design with a ground fill:

Fritzing-1

Fritzing-2

Next week we’ll get 5 of these printed and assemble them and then I’ll post some more photos.

by Andrew Smith at October 16, 2014 11:47 AM


Linpei Fan

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.

by Lily Fan (noreply@blogger.com) at October 16, 2014 02:07 AM

October 15, 2014


Frank Panico

Lesson Learned… [ -__- ]

Never will i put my personal email as a git repo email again… im at about 80 left to delete, out of the 200 I woke up to this morning…


by fpanico04 at October 15, 2014 10:49 PM


Yoav Gurevich

0.2 Milestone Progress Report

A few weeks into the workload at hand, and after finding a bug and initially attempting to setup the development environment a few times, a problem that seems to be repeating itself in recent times is the inherent constraint of other work from full-time courses as well as a cursed history of personal less-than-stellar time management skills when dealing with more than one substantial subject or task at a time. Unfortunately, with this particular upcoming Friday being riddled with more than just this deadline, I will be scrambling to procure a pull request for this in the next day or two. 

At the very least, I'm in slight familiar ground with CSS and armed with a broad but tested strategy of element/CSS property inspection using web browser development tools to pinpoint where the snippet of code I'm looking for is located.

This epic cliffhanger will conclude with a blog post at the end of the week.

by Yoav Gurevich (noreply@blogger.com) at October 15, 2014 09:07 PM


Jordan Theriault

Fixing Issue #308 on Mobile Webmaker

Another bug I am working on is issue #308 for Mobile Webmaker. This issue is to add functionality to the sign-up form so users can see before they submit if a username is taken. In order to detect changed content, I’ve used v-on=”changed: ” directive within the HTML element. Once focus is taken away from the element and a change has been made to the content of the input, a method is triggered to check the authorization server via POST.

Alternatively, this functionality can be easily changed to check upon each key pressed, but may put a larger load than necessary on the device and authentication server to process the many POST requests.

Ultimately, the server responds with if the name is taken or not. Implementation for how this response will be displayed is still to be determined.

To see the code, you can view the branch here and learn about the webmaker authentication client here. Additionally information on Vue directives, which drive Mobile Webmaker’s visuals, can be read here.

by JordanTheriault at October 15, 2014 06:01 PM


Ryan Dang

ocLazyLoad dynamically loading Angular module

So recently, a project I was working on required me to change the way how all the existing angular modules are loaded. instead of loading all angular modules at once when the user visit the page, we want to only load the required modules for the page that the user currently at. The reason we want to only load specific modules because it will reduce the initial loading time. So we had over 20 angular modules for our web page and they are all loaded when the user visit a page. The goal is to only load 1 module at the time.

After doing some research on the web, I found ocLazyLoad is what I need to get the job done. It is very simple to use. You can install it by running bower install ocLazyLoad or npm install ocLazyLoad. Once you have it installed, you can load any module with

$ocLazyLoad.load({
    name: 'TestModule',
    files: ['testModule.js', 'testModuleCtrl.js', 'testModuleService.js']
});

You can learn more about ocLazyLoad at https://github.com/ocombe/ocLazyLoad. Everything is documented there and they also have few examples to help you start.


by byebyebyezzz at October 15, 2014 02:40 PM


Andrew Smith

Development/production setup for work on live Android app with a server backend

One of the interesting challenges working on Everyone’s Timetable is that it’s a live application with a server backend. That means that any one of the following can cause a very serious problem:

  • A change to the Android app that’s not compatible with the PHP server code
  • A change to the PHP server code that’s not compatible withe the Android app
  • A change to the PHP server code that’s not compatible with the MySQL database schema
  • A change to the MySQL database schema that’s not compatible with the PHP server code
  • A loss of real user data in the MySQL database.

It’s hard enough to promote such a limited-reach mobile app. If on top of that the app stopped working all of a sudden, or the users found their accounts deleted or their data missing – they would probably leave complaining and never give the app another shot.

But I need to do development, which means I need to touch all of the points listed above – the app, the server code, the database schema, and the data in the database. How do I do it without risking a catastrophic bug?

This may be something that web people do all the time, I imagine it’s quite a common problem, but it’s the first time I’ve run into it so I will write up my experience. Since I am a beginner with online services – perhaps my experience will serve other beginners as well.

1. Version Control

First of all you need version control. I chose to use Git for this project mainly because it’s time for me to learn it. For many reasons it’s a dumb system for small developers who aren’t already Git experts but its popularity is undeniable, so might as well get used to it. Whatever I’ve done with it you should be able do in SVN just fine.

1.1 Release Tags

I have one repository for my Android code, and one repository for my server PHP code. At first I’ve done all the development in master. Then I got to the first release, 1.0. For this I created a tag, since a branch seemed unnecessary.

1.2 Branches

Now with the release properly versioned I had to set up the development branches. I chose to create a “devel” branch in both repositories.

You will find a thousand pieces of advice online about how to do branching “properly”.  I am following neither. You can pick and choose what advice you want if you’re so inclined, in this guide I’ll only explain how to make the simplest development setup.

The idea is this: after the first release:

  • All development work will be done on the devel branches, unless some major emergency happens in master and then I’ll deal with it as a one-off.
  • The code in the client devel branch will only talk to the code in the server devel branch.
  • The code in the server devel branch will not touch the production database.
  • When it’s time for a new release (and not earlier) a merge will be done from devel to master.

Read on to see how I actually managed to accomplish that.

2. Development database

Bad code can cause not only cosmetic problems (a crash, a failed request) but more serious data corruption problems. The database could get corrupted because of bad client requests, or a mismatch between the client and server, or bad server code. All of that is fair game during development and none of it is an acceptable risk for production.

So just as we need separate branches for the code – we need a separate database for the data. Not a separate server or anything, just a separate database on the same server.

I didn’t have a script to create the original database so I had to relearn how I created it, and do the same for the new one. It wasn’t very hard, just a CREATE DATABASE and a couple of GRANTs. Then to populate the devel database (with the schema and data) I did something like:

mysqldump -u root -p et > et.dump
mysql -u et -pMyPassword etdevel < et.dump

Notice that I am using the same user (et), I don’t see a problem with that.

If in the future I decided I need more test data or more current data – I could simply rerun those two commands.

3. Server: two copies & post-checkout hook

The best idea I could come up with for the code on the server was to have two copies of the server repository in two directories. The release code in the master branch checked out in the et directory and the devel code in the devel branch checked out in the et-devel directory.

That way I could have both exist at the same time and not step on each other’s toes, except they both access the same database. To make sure each branch uses the correct database I set up a git hook that generated a PHP file with a variable definition in it. My .git/hooks/post-checkout looks like:

#!/bin/bash

BRANCH=`git rev-parse --abbrev-ref HEAD`

echo -n '<?php $branch = "' > branch.php
echo -n $BRANCH >> branch.php
echo '"; ?>' >> branch.php

Which generates a very handy branch.php with just this in it:

<?php $branch = "master"; ?>

And with that variable defined I can now make sure that when I connect to the database I connect to the correct one, for example:

if ($branch === "master")
  $db = @mysqli_connect("localhost:3306", "user", "pass", "et");
else
  $db = @mysqli_connect("localhost:3306", "user", "pass", "etdevel");

4. Client: pre-build hook

I did not want to have multiple copies of the client repository on my laptop. I wanted an easy way to switch between devel and master, and an easy way to merge devel into master. Creating a branch was the easy part – the hard part was making sure that the code in the devel branch would only use the server devel branch and the code in the master branch would only use the server master branch.

It so happened that I was already only referencing the URL of the web service in a single place in my client (java) code. A single string that looked like this:

public static final String wsURL = "https://littlesvr.ca/et/et.php";

If I had references to my server production code (et/) in multiple places – that would make the process slightly more complicated but not so much.

I replaced that one line with this:

public static final String wsURL = MainActivity.context.getString(R.string.et_php_url);

I won’t bother explaining the static MainActivity.context, you can find your own way to deal with that java shit. The interesting part is R.string.et_php_url. Where does it come from? It comes from the XML file res/values/auto.xml. Where does that come from? It is automatically generated by my pre-build script, something like this:

$ cat pre-build.sh
#!/bin/bash

BRANCH=`git rev-parse --abbrev-ref HEAD`
AUTOXML=res/values/auto.xml

echo '' > $AUTOXML
echo '' >> $AUTOXML
echo -n '  ' >> $AUTOXML
if [ $BRANCH = 'master' ]
then
  echo -n 'https://littlesvr.ca/et/et.php' >> $AUTOXML
else
  echo -n 'https://littlesvr.ca/et-devel/et.php' >> $AUTOXML
fi
echo '' >> $AUTOXML
echo '' >> $AUTOXML

Note that this auto.xml is not versioned, in fact it’s in the .gitignore. The whole point was to have the server string switch seamlessly when I checkout master/devel, without merging anything.

To make sure the pre-build.sh script gets called before a build I did this in Eclipse: right-clicked the project -> Properties -> Builders -> New -> Program. Filled that in and moved the new builder all the way to the top (above Android Resource Manager).

Could I have called the script from a post-checkout hook? Yeah probably, but I’ve done this before I learned about that hook, and might as well show you two ways to do it :)

There’s more I could write on the topic but this post is already way too long, so there you go, I hope it was helpful.

by Andrew Smith at October 15, 2014 04:30 AM


Andrew Li

Open Source Case Study on Polymer

I posted an introduction to Polymer a while back, here is the follow up post with more info on how it is licensed, the community and where to go to get involved.

1. What is Polymer

2. License, Code and Community

3. How to get involved?

4. Download Presentation Slides

What is Polymer

Polymer is a library that utilizes Web Components. Everything in polymer is an element so HTML, CSS and Javascript can be bundled together to create an application. Once bundled, you can use it by declaring it just like any regular HTML tag.

Currently, Polymer implements a set of polyfills to make current browsers compatible. Eventually the polyfills will be eliminated as browsers get native support.

License, Code and Community

The code is licensed under BSD. You can modify or distribute the code as long as the copyright information is included, the disclaimer message is provided and the names of its contributors are not used to endorse or promote.

You can get the code here and find documentation here. The Polymer developers hang out on IRC in the #polymer freenode channel. To get in the loop join the Google Groups mail list. For just the highlights you can follow them on Google+ or Twitter.

How to get involved?

Explore the code, read the contributor’s guide, test and file bugs, create elements and share it with the community.

Download Slides

dps909-polymer-presentation.pdf

October 15, 2014 12:00 AM

October 14, 2014


Ali Al Dallal

How to enable new Firefox Preferences page now

In currently Firefox Stable, Beta or Aurora when you enable Firefox Preferences page you will see this popup window (CMD+,) or Firefox Menu and choose Preferences

In Firefox Nightly by default if you access your Preferences page you will see this new dedicated page (Preferences in content)

If you want to get this new page on any other version of Firefox now you can easily enable this in your about:config and search for browser.preferences.inContent and change the value from false to true.

You will now have new Firefox Preferences page :)

by Ali Al Dallal at October 14, 2014 01:12 PM


Shuming Lin

Webmaker

During the weekend, I tried to find a open source project bug to do for release. I am pretty interest the below three project.

Webmaker App

Mozilla Webmaker is all about building a new generation of digital creators and webmakers, giving people the tools and skills they need to move from using the web to actively making the web. To this end, the Webmaker App is an entry point to the Webmaker community that provides a radically simple interface for creating mobile application directly on device.

Mozilla Appmaker

Appmaker is an free Webmaker tool for creating mobile app without learning to code. Using building blocks called Appmaker Bricks, users can create and share mobile apps quickly right in their browser.

Appmaker is the first experiment in a series of tools, platforms, programs, and studies designed to provide a mobile experience which encourages free, decentralized, functional user content creation.

Brackets

Brackets is an open source code editor for web designers and front-end developers. This is a pretty cool editor to develop a web cause Live HTML development which means as you code, HTML changes are instantly pushed to browser without having save. I have post a blog about BRACKETS.

It’s hard to choose one of them, but i finally pick the webmaker. In Week 5,Ms. Kate Hudson talked about Webmaker Mobile prject in class. So I know more about this project and i am starting for it. I may try to do others in future.


by Kevin at October 14, 2014 01:28 AM


Gideon Thomas

UI is not my thing!

Hello everyone,

Sorry for being away for a week. Have had a lot going on and just couldn’t find the time to voice my thoughts.

So we had to find a bug to work on for release 0.2 which is due in less than a week. And as much as I would have loved to, I could not work on MakeDrive for this. So, I found it hard to find a way to approach searching for an appropriate bug to work on. I looked at the different options available to me – Mobile Webmaker, Cordova/Firefox OS, Appmaker and Brackets.

Brackets was something that I decided to work on possibly for release 0.3 by finding a bug that was not UI related. As far as Cordova is concerned, a lot of my peers have told me to stay away from it due to its sheer complexity. I was thus left with two options – Appmaker and Mobile Webmaker. From a Github standpoint, I wanted to get a ‘Repositories Contributed To’  entry for one of these, so as to show my versatility for web development. However, based on previous experience with Appmaker, I decided to search in Mobile Webmaker instead as I knew that otherwise I would be stuck dealing with something that primarily dealt with UI.

So I began searching through bugs in the Mobile Webmaker repository. I was disappointed. Contrary to my expectations, the bugs were primarily UI related bugs/features. I tried several bug filtering techniques to find a bug that was appropriate for me. Searching by keywords such as ‘feature’ or ‘work’ and searching by labels did not help. So I decided to filter by their milestones. As I searched through the milestones, ascending the periods by date, I finally found a bug that seemed to be sort of back-end related part of their Mozfest milestone.

This issue pertained to testing their localization files which were in JSON, for adherence to a JSON schema. Luckily, I know a decent amount about JSON schemas and since there was enough information in the bug, I decided to take it on. I did so by asking (in the issue itself) two of the lead developers for permission to tackle the bug, which was promptly granted to me.

Hence, after some great work, I was able to find a good bug for me in the UI haystack. Now to begin working on it…


by Gideon Thomas at October 14, 2014 01:26 AM

October 13, 2014


Ava Dacayo

Mozilla Webmaker App

I’ve decided to work on Mozilla’s web-maker app for Release 0.2! What is it? It’s a web app which users can use on their Firefox phones and later Android to build stuff like stores, blogs, etc. Firefox OS smartphones aren’t available here in Canada (correct me if I’m wrong) but here’s a picture I took when it was being passed around during class:

firefox os

I started by looking for bugs in their GitHub repo and found one which was about building one of the templates. Unfortunately I didn’t get to work on that one because the milestone wasn’t done yet and I think I might get more confused if I continue.

So I went on and looked for another bug and found #Issue 294 – Localize sign-up page. Currently the sign-up page is not localized (viewing the texts in a different language).

I’ll be posting more about it next time when I finish working on it!


by eyvadac at October 13, 2014 11:50 PM


Brendan Donald Henderson

Exploring packages to determine aarch64 compatibility

This post is based on my research into linux packages to determine:

  • Their existence in the Fedora, Debian, and Ubuntu Linux Distributions
  • Their existence on aarch64 Fedora
  • If the packages contain any platform specific code and if so what is the code’s purpose?
    • If platform specific assembly does exist, is there assembly to support aarch64?
    • Can this assembly be replaced by C code and can performance be optimized as a bonus?

I do want to note that this blog does not completely cover analysis of the platform specific code or optimization opportunities, however I do point out things that I believe would show to be great performance optimization opportunities on further inspection. For a few of these packages this further inspection will be in the next post!

List of packages that will be discussed:

  • pcre3
  • unrar-free
  • vflib3
  • php-apc
  • mysql-5.5
  • fwts
  • llvm-3.1
  • smlsharp
  • mpfr4
  • gccxml
  • puf
  • insserv

Investigation Notes for each package:

pcre3:

  1. Available on: Fedora as pcre, Ubuntu as libpcre3, Debian as libpcre3
  2. Not Available on: N/A
  3. Purpose: Perl-compatible regex library that also includes a posix api front-end.
  4. Priority: Low as seems to already exist on aarch64 as pcre.aarch64 package.
  5. Opportunities: the embedded asm is used for JIT code for performance, interesting JIT opportunity!

unrar-free:

  1. Available on: Debian and Ubuntu(same package name)
  2. Not Available on: Fedora, aarch64 Fedora
  3. Purpose: Compression/decompression tool.
  4. Priority: Low priority as there are other software packages with the same purpose.
  5. Opportunities: embedded x86 asm is used for decompression performance, very likely that modern gcc will beat this and so could be very great performance optimization opportunity!

vflib3:

  1. Available on: Ubuntu and Debian(same package name)
  2. Not Available on: Fedora, aarch64 Fedora
  3. Purpose: Font-rasterizer library.
  4. Priority: Low priority as not crucial package.
  5. Opportunities: embedded x86 asm is used for performance, very likely that modern gcc will beat this and so could be very great performance optimization opportunity!

php-apc:

  1. Available on: Fedora as php-pecl-apc, Ubuntu and Debian as php-apc. aarch64 Fedora as php-pecl-apcu.aarch64
  2. Not Available on: N/A
  3. Purpose: Alternative PHP Cache module for php5
  4. Priority: High priority.
  5. Opportunities: asm for various platforms for atomic operations, seems like great opportunity to let modern gcc do a better, more portable job?

mysql-5.5:

  1. Available on: Fedora as mysql, Ubuntu and Debian as mysql-server-5.5. Might exist on aarch64 Fedora as community-mysql.aarch64
  2. Not Available on: Not sure if the aarch64 package above is the same as the ones mentioned for x86 distributions.
  3. Purpose: mysql database, version 5.5.
  4. Priority: Highish priority.
  5. Opportunities: x86 asm for performance with crypto and checksum as part of embedded yassl code. Very interesting performance/security optimization opportunity!

fwts:

  1. Available on: Couldn’t find it for any of the x86 distros or aarch64 Fedora
  2. Not Available on: info above.
  3. Purpose: Firmware Test Suite
  4. Priority: Marked as “already being worked on” on the code module page on the Linaro site. x86 asm is trivial, possibly not important?
  5. Opportunities: N/A

llvm-3.1:

  1. Available on: Fedora as llvm, Ubuntu has newer llvm-3.3, Debian as llvm-3.1. aarch64 Fedora as llvm.aarch64(not sure if same package)
  2. Not Available on: N/A
  3. Purpose: Low Level Virtual Machine.
  4. Priority: Low Priority.
  5. Opportunities: N/A

smlsharp:

  1. Available on: Ubuntu
  2. Not Available on: Fedora, aarch64 Fedora, Debian.
  3. Purpose: Standard ML Compiler.
  4. Priority: Low priority.
  5. Opportunities: Contains asm source code file, may be old procedures? Embedded asm for atomics and checksum performance(both have C fallback) but great opportunity to find out if gcc can bring performance optimization!

mpfr4:

  1. Available on: Fedora as mpfr, Ubuntu and Debian as libmpfr4. aarch64 Fedora as mpfr.aarch64
  2. Not Available on: N/A
  3. Purpose: Multiple precision floating point math library.
  4. Priority: Medium Priority as it is a toolchain dependency.
  5. Opportunities: arm32 asm done but not aarch64. Is aarch64 still new enough that gcc doesn’t provide competitive floating-point optimization options?

gccxml:

  1. Available on: Fedora, Debian, and Ubuntu as gccxml.
  2. Not Available on: aarch64 Fedora
  3. Purpose: XML description generator for C++ programs.
  4. Priority: Low Priority, not widely used.
  5. Opportunities: N/A

puf:

  1. Available on: Ubuntu and Debian
  2. Not Available on: Fedora, aarch64 Fedora
  3. Purpose: Parallel url fetcher.
  4. Priority: Low priority for porting.
  5. Opportunities: trivial x86 asm for bitops performance with C fallback. Great opportunity to see if gcc can optimize performance.

insserv:

  1. Available on: Ubuntu and Debian
  2. Not Available on: Fedora, aarch64 Fedora
  3. Purpose: Boot sequence organizer
  4. Priority: Low Priority.
  5. Opportunities: No asm, preprocessor definition needs to be changed.

 

These are the basic notes from my research of the packages.

I have not yet dived into the packages and started searching for the assembly myself but that will be the topic of the next upcoming blog post!

I will also detail porting and optimization related info much more in the next post.


by paraCr4ck at October 13, 2014 06:21 PM


Frank Panico

Ramping up on Webmaker-app

So after adventuring through David’s choices for a project to work on for our next release; I’ve chosen Webmaker-app.

I found this appealing mostly due to the fact that I’m also in York University’s Tech Ed program, meaning that I’m interested in finding ways to use the web and other tools to inspire and engage youth into technology and that its use goes beyond taking sweet selfies.

I’m also sure that since the main community is all about furthering this exact cause, that they’ll be empathetic to me being a n00b trying to learn new things myself, so I shouldn’t feel overwhelmed to help out or ask for help.

I’ve signed up for bug #305 (https://github.com/mozillafordevelopment/webmaker-app/issues/305) which is to display to the user that something has gone wrong with their sign up process because they haven’t “accepted” the terms and conditions.

I’m excited to start foraging through code and get to resolving this.


by fpanico04 at October 13, 2014 06:48 AM

October 10, 2014


Jordan Theriault

Leaflet.js Woes

In continuation with my last post, I been developing the Map Brick for Mobile Webmaker. In order to allow many different types of Maps to be used, I have begun integrating Mobile Webmaker with Leaflet.js which is a javascript library that allows for easy, interactive, mobile friendly maps. There is a Node Package Manager installation which I have used but there exists little documentation on it’s usage.

Integrating the existing Mobile Webmaker with Leaflet has been challenging. Getting the map to display properly is clearly a lack of proper implementation of the Leaflet CSS and JS so I’m working on find out how to properly implement it.

Currently I am using OpenStreetMaps and getting a very fun result (Firefox Nightly Build).

Screen Shot 2014-10-10 at 12.00.04 PM

I will update with progress once the maps are properly displaying to show you the amazing maps that Leaflet.js in combination with a map API produces. You can follow my progress on implementing Leaflet here.

by JordanTheriault at October 10, 2014 04:14 PM


David Humphrey

Minimum Viable Product

This week in class I was discussing the value of thinking in terms of a Minimum Viable Product (MVP), and how open source tends to favour the approach, because it allows one to ship, test things with real users, get feedback quickly, find and fix bugs, and repeat. Structuring your project, and the scope of your bugs, such that you can ship quickly really matters. I mentioned a fantastic image I'd seen on Twitter (source):

MVP

What you start with often feels completely lacking, almost embarrassing; and yet you have to do it, you have to make a start.

Tonight I'm reading about the RC for Redis Cluster, and I see this amazing paragraph toward the end:

Finally we have a minimum viable product to ship, which is stable enough for users to seriously start testing and in certain cases adopt it already. The more adoption, the more we improve it. I know this from Redis and Sentinel: now there is the incremental process that moves a software forward from usable to mature. Listening to users, fixing bugs, covering more code in tests, …

Everything I was trying to say is there. This is how you do it.

by David Humphrey at October 10, 2014 02:58 AM

October 09, 2014


Tai Nguyen

Class Notes – Git 101: Recursive Merge vs. Fast-Foward Merge

In Git, when you want to join two different branches together you can use two different merge strategies; fast-forward and recursive.

When you merge two branches together, you can either do a fast-forward merge or a recursive merge. The fast forward merge essentially moves the current branch pointer to the latest commit if you have done a git fetch; fast forward merge is usually applied when there is no difference in the histories of the two branches. If there the histories of the two branches are different, then a recursive merge is necessary. A recursive merge creates a new commit and does a three way association. The three way association involves three other commits. Basically, the newly created commit is linked two parents; the parents being the latest commit from each branch. The last commit associate is the commit where the branches departs from each other.


by droxxes at October 09, 2014 03:33 AM


Gary Deng

Setup Appmaker Development Envrionment

After playing around with Mozilla appmaker, I choose to work on issue #2253.  To be honest, I had a hard time to setup the development environment. Thanks Ali for pointing me to the right direction, now I am able to run appmaker locally.

Webmaker-suite is very helpful for new developer to install all webmaker components to get started. It is for the terminal-menu based package manager and task runner for the webmaker suite of tools; However, I was stopped by the Elasticsearch dependency. I have tried different installation methods, and Elasticsearch was working properly, but webmaker-suite just didn’t pick up that. It keeps telling me that dependency is not installed which almost drove me crazy! This morning, I went to IRC #appmaker channel and post my question. What a coincident, another developer got the same problem. He or she told me to ignore the issue and run Elasticsearch manually.

But I still can’t run the command “node run” which gave me error message about the Elasticsearch. Then I went to CDOT to seek some help from Ali. Finally, Ali helped me solve the problem which was that my Mongodb was running automatically before I do “node run”. I should kill the process before running command “node run”. If anyone wants to use webmaker-suite package manager to set up dev environment for appmaker, you only need “Login”,”MakeAPI”,”Make valet”,”Appmaker”,and “MongoDB”. Google around to find any relevant instruction is not enough, asking questions in the project community is the most direct way to get help quickly.

 


by garybbb at October 09, 2014 02:14 AM

October 08, 2014


Kieran Sedgwick

[OSD600] Staying in touch with a project

I’m making a concerted effort to jump back into open-source development now, inspired by both my OSD600 class and my enjoyment of contributing, and I was struck by a thought I’d had before, but been unable to vocalize.

Open source development of popular projects moves quickly, and within just a few weeks projects I was intimately familiar with have, or are about to, change dramatically. MakeDrive is a great example. I was part of the core development team on this project this past summer, and within days David Humphrey will be landing an enormous patch that completely overhauls the guts of the project. This is normal, and excellent!

It’s also a good reminder that the only way to stay knowledgable about any codebase, but open-source ones in particular, is to keep working on them! Learning a codebase is like carrying a bowling ball up a flight of stairs, and stepping away from it for even a pretty brief period is like dropping that bowling ball and watching it roll down to the bottom of the stairs.

On the one hand, this is why being a developer is so engaging! There’s always an opportunity to learn, to explore, to grow. It also means that we mostly start from scratch when approaching a new project, or an old one we’ve been uninvolved with for a while. The experience translates over to an easier time taking off with the project, but it means being complacent creates work in the form of refamiliarizing oneself with a project.

I happen to be enjoying this process, and have more thoughts on digging into an unfamiliar project, but those will likely appear in a follow up post.


by ksedgwick at October 08, 2014 04:15 PM


Adam Nicholas Sharpe

Basic Loops and Conditionals on x86-64

Last week in SPO600, we were given a lab that had us writing loops and conditionals in Assembly. I missed that class, so I had a heck of a time figuring out how to do this on my own haha...

Anyhow, the gist of the lab was using only Assembly and Linux system calls (is this the same as POSIX?), write a loop that displayed all the numbers from 0 through 30. Then, try to do this while suppressing the leading zero. As an optional challenge, we could display the 12 x 12 multiplication table.

The solutions I came up with were ugly, not robust, and easily breakable, but they got the job done. I definitely did not write Assembly in the proper way, but I wanted play around with the memory stack and solve the problems in a kind of funny way...

My solution to the first problem is as follows:

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.text
.global main

main:
push %rbp
movq %rsp, %rbp
subq $0x2, %rsp
movq $30, %r15
movq $0x0, %r14

condition:
cmp %r15, %r14
jg loop_done

movq $0x1, %rax
movq $0x1, %rdi
movq $loop_text, %rsi
movq $loop_text_len, %rdx
syscall

movq %r14, %rax
movq $10, %r13
xor %rdx, %rdx
divq %r13
addq $0x30, %rax
addq $0x30, %rdx
mov %al, -0x1(%rbp) /* quotient */
mov %dl, -0x2(%rbp) /* remainder */

movq $1, %rax
movq $1, %rdi
leaq -0x1(%rbp), %rsi
movq $char_len, %rdx
syscall

movq $1, %rax
movq $1, %rdi
leaq -0x2(%rbp), %rsi
movq $char_len, %rdx
syscall

movq $1, %rax
movq $1, %rdi
movq $new_line, %rsi
movq $char_len, %rdx
syscall

inc %r14
jmp condition

loop_done:
movq $0, %rdi
movq $60, %rax
syscall

.data
loop_text: .ascii "Loop: "
.set loop_text_len, . - loop_text
new_line: .ascii "\n"
.set char_len, . - new_line

I probably didn't need to use the memory stack, but wanted to play around with that. I put two bytes on the stack, one to store the quotient, one to store the remainder. Basically, the idea is to divide by 10, convert the quotient to a character (by adding 48), display it, and do the same for the remainder. There are two things wrong with this solution:

1. It is limited to displaying numbers in decimal notation that have at most two digits.
2. It displays a leading zero.

A better solution would avoid these problems. Here is what I tried. This solution can display up to eight digit numbers, and suppresses leading zeroes. However! A better solution would be to keep dividing until the quotient is zero (so as to avoid the hard coded 8-digit limit). Also, the way I suppressed leading zeroes also suppressed the leading zeros for the number 0, resulting only in spaces. The way I 'fixed' this was a simple conditional before entering the loop. However, this solution sucks quite frankly...

Anyhow, here it is:

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
text
.global main

main:
push %rbp
movq %rsp, %rbp
subq $0x8, %rsp
movq $30, %r15
movq $0, %r14

/* Test if my index variable is less than or equal to 30 */
condition:
cmp %r15, %r14
jg loop_done

/* Print the string "Loop: " */
movq $1, %rax
movq $1, %rdi
movq $loop_text, %rsi
movq $loop_text_len, %rdx
syscall

movq $1, %r12
movq %r14, %rax

/* Hacky solution to display the number if it's zero. My int_to_chars below
* suppresses leading zeroes, even if the value is zero haha... There are better
* ways to do this, (ie this solution sucks) but I'm getting fairly tired, and
* am running out of freakin' callee preserved registers... */

cmp $0, %rax /* If RAX is zero... */
jne int_to_chars
movb $48, 0x7(%rsp) /* Move a zero character to last character position
* to be printed, which in my int_to_chars section,
* is 7 bytes above the stack pointer... */

addq $1, %r12 /* And add one to our counter used in the int_to_char (because the
* first and only digit ('0') is already on the stack... */

/* Section to convert a number in decimal notation, with up to 8 digits to a
* sequence of characters in reverse order, replacing leading zeroes with a
* space character, and on store them in the memory stack */
int_to_chars:

cmp $9, %r12
je display_integer

cmp $0, %rax
je put_space

movq $10, %r13
xor %rdx, %rdx
divq %r13
addq $48, %rdx /* Converts remainder digit to its character */
movq %r12, %r10
movq %rbp, %r11
subq %r10, %r11 /* Where to put the remainder digit in memory */
movb %dl, (%r11) /* Move character to address in previous calculation */

addq $1, %r12
jmp int_to_chars

put_space:
movq %r12, %r10
movq %rbp, %r11
subq %r10, %r11 /* Where to put the remainder digit in memory */
movb $32, (%r11) /* Move character to address in previous calculation */
addq $1, %r12
jmp int_to_chars

display_integer:
movq $1, %rax
movq $1, %rdi
leaq -0x8(%rbp), %rsi
movq $8, %rdx
syscall

/* Print the new-line character... is there a better way than actually storing
* the literal newline in the data part of the code? Probably... */
movq $1, %rax
movq $1, %rdi
movq $newline, %rsi
movq $char_len, %rdx
syscall

addq $1, %r14
jmp condition

/* Exit with status 0 */
loop_done:
movq $0, %rdi
movq $60, %rax
syscall

.data
loop_text: .ascii "Loop: "
.set loop_text_len, . - loop_text
newline: .ascii "\n"
.set char_len, . - newline

The last challenge we were given was to display the 12 by 12 multiplication table. Again, the limit of the two numbers being at most two digits, and the products being at most three digits is a hard coded limit... My idea was to put a formatted string onto the memory stack, and add in the number parts based on what I was calculating in the for loop. A more robust solution would dynamically construct the entire string, including the hard-coded characters each time the loop iterates, keeping track of its size. Also, my solution does not suppress leading zeroes (If I were forced to, I would do this in a similar way to the previous problems):


  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
.text
.global main

main:

push %rbp
movq %rsp, %rbp
subq $0x10, %rsp

/* The idea here is to layout on the memory stack, a string of the form:
*
* "__ * __ = ___\n"
*
* , where the blanks are values to be calculated below, for each iteration
* of the double loop. Start by setting up the constants in the string: */
movb $32, -0xe(%rbp) /* ASCII value for space */
movb $42, -0xd(%rbp) /* ASCII value for '*' character */
movb $32, -0xc(%rbp)
movb $32, -0x9(%rbp)
movb $61, -0x8(%rbp) /* ASCII value for '=' character */
movb $32, -0x7(%rbp)
movb $10, -0x3(%rbp) /* ASCII value for newline */

movq $0, %r15 /* Outer loop index */
movq $0, %r14 /* Inner loop index */

outer_loop:
cmp $12, %r15
jg end

movq $0, %r14

inner_loop:
cmp $12, %r14
jg inc_outer_counter

print_nums:

/* Divide the outer loop counter by ten... */
xor %rdx, %rdx
movq %r15, %rax
movq $10, %rbx
divq %rbx

/* and then put the characters that represent the quotient and remainder
* onto the memory stack in the correct position... */
addq $48, %rax
addq $48, %rdx
movb %al, -0x10(%rbp)
movb %dl, -0xf(%rbp)

/* and then do the same for the inner loop index. */
xor %rdx, %rdx
movq %r14, %rax
movq $10, %rbx
divq %rbx

addq $48, %rax
addq $48, %rdx
movb %al, -0xb(%rbp)
movb %dl, -0xa(%rbp)

/* Do the actual multiplication on outer loop and inner loop */
movq %r15, %rax
mulq %r14
movq %rax, %r13 /* Move our product out of the way */

/* Since the product may be three digits, we must divide and take the
* remainder twice: */
xor %rdx, %rdx
movq %r13, %rax
movq $10, %rbx
divq %rbx

addq $48, %rdx
movb %dl, -0x4(%rbp)

xor %rdx, %rdx
divq %rbx

addq $48, %rax
addq $48, %rdx
movb %al, -0x6(%rbp)
movb %dl, -0x5(%rbp)

/* Now print the thing... this is fun! :D */
movq $1, %rax
movq $1, %rdi
leaq -0x10(%rbp), %rsi
movq $14, %rdx
syscall

/* Add one to the inner loop counter, and do it all again! */
inc %r14
jmp inner_loop

/* Add one to the outer loop counter, diplay the dashy line, and then do it
* all again hohoho... */
inc_outer_counter:
inc %r15

movq $1, %rax
movq $1, %rdi
movq $line, %rsi
movq $line_len, %rdx
syscall

jmp outer_loop

end:
movq $60, %rax
movq $0, %rdi
syscall

.data
line: .ascii "----------------\n"
.set line_len, . - line

I actually had a lot of fun coding Assembly, and would love to spend lots and lots of time figuring out the most robust (ie: no hard coded limits) solutions to displaying nicely formatted output. Alas, these problems have already been solved (it's called stdio.h :P). Actually, over the upcoming reading week, I would actually like to revisit this lab and do a 'proper' solution, or at least look at the source of some of the C standard library to see how this stuff is really done.

*Sigh* At times I feel as though I was born in the 'wrong' generation of programmers... I would love to do this kind of stuff for a living...

by Adam Sharpe (noreply@blogger.com) at October 08, 2014 01:57 AM

October 07, 2014


Jordan Theriault

Mozilla’s Webmaker App – Building the Map Brick

I have proposed and assigned myself the task of developing a map brick for Mozilla’s Webmaker App project. I proposed the idea in this issue on the Github page.

I intend to use Google Map’s API in order to serve the maps to the web site creator. The user will be able to select a location on the map to give the location as well as include an address. The personas for this application are varied: a business giving the location of the store, a group giving a meeting location, an adventurer providing a geocaching co-ordinate, a host giving attendees of their party their house address, and more.

The published view will give a map with a marker on the location indicated by the editor. On the editor side, there will be a map in order to let the editor select a location for the marker(center of the map will be put into the attributes long and lat of the map brick). Further, a string will be available to set the readable address for the location.

For potential barriers, an agreement will need to be made with Google in order to provide this API service to a more scalable audience. Further, the map may need to be cached in order to provide a lower load on the mobile devices being used.

If you have any questions, comments, ideas, or want to get involved for the development of this issue, please comment on the issue page on Github.

by JordanTheriault at October 07, 2014 06:37 PM


Ava Dacayo

Release 0.2 – Still looking for bugs

There are different projects available and I still don’t know which one to pick!

Basically, I’m looking for bugs that seem doable for the release 0.2 due date in Oct 17. And I better be fast because I am thinking the others are doing the same thing too! :p That also involves talking to the contributors if that bug is available and of course assign the bug to myself (or someone assigns it?) so that it is clear that I will be working on it! I hope to have started on something by the end of this week. I will be posting more details about the bug I will be working on soon!


by eyvadac at October 07, 2014 12:23 PM


Linpei Fan

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.


by Lily Fan (noreply@blogger.com) at October 07, 2014 04:17 AM

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.

by Lily Fan (noreply@blogger.com) at October 07, 2014 03:19 AM

SPO600: Static linking vs. Dynamic linking

Linkeras 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:




by Lily Fan (noreply@blogger.com) at October 07, 2014 03:08 AM

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.   

by Lily Fan (noreply@blogger.com) at October 07, 2014 02:27 AM


James Laverty

Intro to James 101

This is my first blog. I am writing to you to say hello and that I am very excited. My blogs will get a little more technical after this, but for now I'm keeping it as a simple hello.

by James L (noreply@blogger.com) at October 07, 2014 12:24 AM

A 'Bug' Story

Hey everyone,

Bug Tackling!

I've decided to try and tackle a bug in the Webmaker app! It seems cool and fantastic.
The bug I'll be doing is to make a template for a blog(Blogger, he's lookin at you kid). Me and my friend Rafid are gonna be helping each other out with our separate bugs trying to en capture the essence of Open Source development.

Aside from that, life's getting fun! Learning about +Twitter ,and +FireFox, developing an Android app and many other things!

It seems upon initial inspection that fixing bugs is a daunting task, it's like climbing Mount Everest after only doing indoor climbing. The basic techniques are there, but looking up, the challenge seems way bigger than you (I'm an avid indoor rock climber).

This will be challenging, frightening,  and I'm sure, super rewarding!

You can follow me on twitter @0neSanctum (I'll get better I promise)

Cheers.

James Laverty

by James L (noreply@blogger.com) at October 07, 2014 12:21 AM

October 06, 2014


Andrew Li

Appmaker for Release 0.2

For release 0.2, I will be working on Appmaker. It’s an app that makes apps, allowing anyone to create things without having to learn code.

It uses Polymer for building bricks which are basically components made up of web technologies like HTML, CSS and Javascript.

Getting Started

Appmaker has an excellent guide on how to contribute, it links to a tutorial that shows how bricks are built. There’s also a Brick Contribution Workshop page that walks through the brick building process.

Setting a developer instance

I just followed the readme.

If your on OS X then you can install mongodb with homebrew

brew update
brew install mongodb

I had trouble running mongod after installing since I didn’t have the /data/db folder.

sudo mkdir -p /data/db

Creating the folder still didn’t work since mongod didn’t have permission. This worked.

sudo chown `id -u` /data/db

After running mongod and starting the server with node app.

Hurray, time to start exploring.

http://localhost:5001/designer

October 06, 2014 12:00 AM

October 05, 2014


Yasmin Benatti

Release 0.2

For the Open Source class, until October 17th I have to complete my second release in an open source project. This time I decided to work on a project called App Maker. It is a tool, developed by Mozilla, where one can create apps from his/her phone.

Last week, Kate Hudson, who works at Mozilla and with the App Maker team, came to talk with the class about it. It was a coincidence that she talked about the projects I was interested in, what made me want to work even more with it. Something really interesting that she said is that there is a research in the areas Mozilla pretends to bring this app. So they see which kind of application the community would need, the tools they might want and this way they  can do something valuable and extremely useful.

I’m leaning to work on a simple bug, you can find here. It is about creating a button that redirects the user to a web page. I chose  something simpler, so I can try to complete all the steps this time.

More information about App Maker can be found at their web site, the github account or at the IRC channel #appmaker.

Cheers!

by yasminbenatti at October 05, 2014 01:06 PM

October 04, 2014


Yoav Gurevich

Initial Bug Scavenging

Last week I've managed to scour the Appmaker repository for issues that might be my pace to start off with. I ended up finding Issue #2251 which in accordance with the recommendations of professor David Humphrey and seasoned mozillian Scott Downe, this seems to be the perfect scope for the deadline and for dipping my feet in the Appmaker environment for the first time. The size and priority of the bug itself are at a state where it is extremely unlikely to block anyone from continuing their current work on the codebase which also provides me with more time to acquaint myself with the logical hurdles and conventions that naturally baggage themselves with a new project I'm about to dive into. Perhaps if done early, I might be able to find another one before the 0.2 deadline.

by Yoav Gurevich (noreply@blogger.com) at October 04, 2014 07:21 PM


Frank Panico

Implement Du?…Du hast…. Du hast mich..

This is exactly how I feel about this release. I come to my keyboard with bloodshot eyes, coffee stained shirt, and bleeding fingers, but it’s finally done. It took a bit of time finagling around the filer code to understand where certain things belonged.

First steps- what the hell is a filer?? I started reading about the project in the github pages Dave had sent us just so I could have a broad understanding of what it was for us to do this release. So Filer is a neat little POSIX based file system  interface for node.js; alright, got it, we needs commands!

Next I needed to know what to du (see what I did there?). Ok seriously though, I found out that du was a utility that displayed the disk usage of a directory structure.

Dave’s presentation of how to go about creating this was actually extremely helpful. Like him i started putting two and du together ( I swear i can do this all day). Looking for code among the repo that resembled unix based calls like cat, touch and ls. I came to this conclusion :

shell.js &
filer.js &
test-utils.js &
(insert unix command here).spec.js  … all had a relationship!

This WAS THE MOST TRICKY PART and took almost more time than coding the damn thing! The biggest issue here was that shell.js and filer.js BOTH HAD IMPLEMENTATIONS! WHY?! THis IS S-du-PID!!

I started slowly and first placed code in test-utils as to declare it ready for testing, then basically copying a spec.js file and modifying it to just recognize the du function. Then placing the implementation ( a very basic one at that) in BOTH shell.js and filer.js (which i still don’t know if it was correct or not but we’ll see after the merge request).

Du has very similiar functionality to ls. Meaning that they both recursively traverse directory structures collecting information about files and directories so I decided to mimic the code found in ls implementations as well as the ls.spec.js code test file.

The rest is history, coding didn’t take much too long after getting a hang of the workflow. I really enjoyed this chance to really play with my editor and use different plugins; like JSHint. I plugged that sucker in and set it up on a shortcut key so i could constantly evaluate my javascript code in case i missed semi colons or brackets (ohhhh those freaking brackets!!!!!!!!!!)

All in all this was a great first exercise and a real eye opener. I only wish i had gotten it in sooner. Sorry Dave… me bad student…


by fpanico04 at October 04, 2014 05:10 AM

October 03, 2014


Kieran Sedgwick

[SPO600] And so, I assemble

My first real encounter with Assembly was this week. Our lab involved implementing a simple loop in 3 phases. I’m still not done, but I wanted to put some thoughts down before they evaporated.

Assembly? Assembly is like…

…speaking very slowly!

My word. I’m loving this course, since it’s giving me such a broad perspective on computer science. In particular, I’m starting to understand exactly what is meant by “highly abstracted” languages. I’d always thought of abstraction as encapsulating combinations of simpler operations and giving the grouping a new name. Now I see what those simplest of operations look like, and it paints quite a picture.

But seriously. Writing Assembly code is like talking …. very …. slowly …. to …. a …. computer …. one …. word …. at …. a …. time. Was that painful to read? So is Assembly. Three quarters of a page of code to output “Hello World!” 10 times seems like watching treacle drain through a sieve!

Not to say I’m not enjoying the process – it’s a whole other level of memory management, and is causing me to approach problems in new ways. Bonus!

…speaking with absolute precision!

Imagine a world with no slang allowed. Denotations are all you have, so assist you omnipotent being of all-knowing power.

Syntax error: “Nope” not recognized. Did you mean, “negative” (alt: “negatory”)?

I know it’s the whole point, but it’s blowing my mind that I’m almost moving electrical switches by hand here. My experience of programming has always highlighted the need for precision, but this is a whole new level. Referencing registers is a particularly good example, since there are many ways to access a register depending on which architecture you’re using, and what you’re trying to do:

mov %r15,%r14 
add $0x30,%r14b /* Convert to ASCII */

In two places I reference the colloquially named register r14, but in two different modes. Different registers have different suffixes for doing the exact same operation, making precision extremely important.

Conclusion

All in all, I’m having a great time with Assembly. It’s technically demanding on the one hand because it’s so new, and on the other because it’s working with the hardware in a way I’ve rarely had to consider since learning C++ two years ago. More to come!


by ksedgwick at October 03, 2014 05:58 PM


Ryan Dang

0.2 Release

So as I mentioned on my previous blog, I was working on UI – Update profile style/content and I almost got it done. I was just waiting for the icon. So after I posted again asking for the pen icon, mhanratty replied telling me to try to use the pen icon from Font Awesome. “Font Awesome is a library that gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS”. To use the library I will need to either download the package and include it in the project or I will have to use bootstrapCDN by MaxCDN by include the provided link to the head section of the html. Looking through the project structure, I didn’t think it is a good idea to download the Font Awesome package and include it in the project so I include the link to the bootstrapCDN in the <head> instead.

After replacing the edit button with the icon from Font Awesome, I did few more test to make sure everything is working properly. I commit the change. I know that there were few patches that were merged in while I was waiting for the icon. So I think it is a good idea to rebase my current working branch to the latest master branch. I change to master branch and pull down all the new changes from mobile app maker repo. I changed back to updating user profile branch and tried to rebase it to the current master branch. There were no conflict so everything is ready to go. I ran and “gulp test” to make sure that I pass all the tests. There were few error regarding missing semi colon. I fixed those errors and run the test again. Everything is good.

I tried to run “gulp dev” to start the application to make sure it still working as intended with all the new changes. While I was testing it I found two other bugs. One is Updating user profile name doesn’t update existing apps created by user. The other one is Templates doesn’t display properly on Firefox which is later fixed by me. After testing and making sure everything is working properly, I pushed my change to my repo and then did a pull request on the mobile appmaker repo. The pull request is accepted and merged in a day after.


by byebyebyezzz at October 03, 2014 03:50 PM


Brendan Donald Henderson

Comparing x86_64 and aarch64 assembly, which do you prefer?

Informal Preamble:

This post discusses my experiences writing a simple assembly language program in both x86_64 as well as aarch64 assembly language. I try to contrast the languages as best I can however I am relatively new to the aarch64 instruction set, in fact this is my first time writing an aarch64 assembly language program. I do come a x86(IA-32) assembly background. However some of the technologies that I am seeing in ARM processors are quite interesting and so I thought I would try to provoke some thoughts for you with these questions:

So at this point of ARM’s existence in the RISC cpu landscape who else is getting excited for the near future?

Some Questions to keep in mind:

  • Will Intel ever fix their power consumption issues to rival ARM?
  • Will ARM take over the server space?
  • What does trust-zone in the cpu mean for ambitious “close-to-metal” security researchers?
  • Is anyone ambitious enough to try for race-condition exploits on Fedora ARM!?

Resources:

x86_64 and aarch64 assembly source code:

https://docs.google.com/document/d/10D2hsKeM5cOOK57Ygpj8lliK_WKt4Loe8D3picH1Byw/edit?usp=sharing

Writing and Debugging in Assembler:

Writing assembly language programs, in comparison to writing programs in higher-level languages, requires a much different mind-set. You need to remember that aside from the simple fact that you are now thinking in terms of much simpler operations like load-operate on-store, in any given order, you must also take into account every little detail that you would otherwise take for granted. An example:

During the process of writing the x86_64 assembly programs for this post I encountered a problem when trying to output 2 digit numbers within a printing loop. I won’t be too specific as I discuss this in depth later on in this article, but what was about a day’s worth of time stuck on this problem turned out to be the simple fact that I was underestimating the importance of clearing the rdx register before an unsigned division(via div). Clearing rdx before the div instruction immediately solved this problem and I was done.

This is where gdb can have an unintended beneficial effect on your mindset! Where gdb seems like quite a primitive debugging tool, its repetitive, methodical, minute step by minute step approach can get you used to thinking in terms of the smallest impact that an operation can have. These small impacts can often have a snowball effect, resulting in larger problems later, and A LOT of extra debugging time.

At this point if you are beginning to wonder why it doesn’t take days to write or debug a “large” program at the assembly level, I would propose that it is due to the value of experience in spotting problem areas as you write your assembly code and ensuring that they are working correctly before moving on.

Also, if you aren’t a big fan of lots of GUI views and menus crowding your screen and you tend to rely more on your experience and reasoning to debug your applications then “simple” command-line tools like gdb can actually be more effective than MS Visual Studio’s debugging capabilities.

x86_64:

I began my assembly programming with the Intel IA_32 instruction set so my transition into x86_64 programming has been pretty smooth. Since the x86_64 version of the program that this blog is based upon is rather simple I didn’t have any noticeable problems. However, the Intel x86_64 instruction set is significantly more complex than the aarch64 instruction set. Just as an example, the aarch64 instruction set reference manual is approximately 150 pages long, the x86_64 instruction set reference is approximately 1500 pages long. So you could see how using advanced features or optimized instructions in place of more basic instructions could get very complicated very fast.

In terms of the assembly for both programs, neither contain noticeably more instructions than the other, and neither was more complicated to write.

One final note as to why I prefer the x86_64 instruction set. The main reason is that while I admit that the advanced instructions that really identify it as a CISC architecture can be difficult for a beginner, they do seem very interesting and I would bet that they are exploited by compilers such as gcc, g++, and intel’s c/c++ compiler at higher optimization settings and can produce noticeable performance gains as a result.

aarch64:

This application was the first aarch64 assembly language program I had ever written. Yet, one of the seemingly largest obstacles, learning the instruction set, was one of the least time consuming aspects of the whole process. I attribute this to the RISC architecture of aarch64. The initial problem when learning the x86_64 instruction set is that even when you do not take into account the more advanced, specialized instructions the simpler instructions still have so many addressing modes and other aspects to them that reading the manual can be a little uninspiring.

One final note in regards to my earlier statement about preferring the x86_64 instruction set to the aarch64 instruction set. For someone who wanted to start learning assembly and the lower level problem solving techniques that are involved I would recommend the aarch64 instruction set to the x86_64.

 

Final Note: To anyone reading this who is interested more in the security related applications of these lower level concepts, I hope within the next month to be able to start posting some material related to the following topics:

  • Disassembly reverse engineering(Windows PE executables)
  • Patching executables for injection or API hooking purposes(code caving)
  • And other higher-level security concepts(more based in c/c++)

I also hope to be able to start doing some security research on ARM platforms if I have the appropriate access to the hardware.


by paraCr4ck at October 03, 2014 01:41 AM

October 02, 2014


Edwin Lum

I don’t always code in assembler, but when I do….

I have quite a bit of fun o;

Being spoiled with being used to programming in higher level languages out there, jumping back to programming in assembler is often times a very refreshing experience for me. It lets one take time to appreciate the beauty of simple steps, and a 1:1 machine code instruction matching.

Even code such as to print the numbers from 0..29, which could be condensed to 1 line in c like this:

for (int x=0; x<30;x++) printf(“%d\n”,x);

becomes many more lines than 1 in assembly. A version for x86_64 as well as aarch64 follows.
x86_64

.text
.globl	_start

start = 0                       /* starting value for the loop index */
max = 30                       /* loop exits when the index hits this number (loop condition is i<max) */

_start:
    mov     $start,%r15         /* loop index */
loop:

	mov	%r15,%rax
	mov	$0,%rdx		/*clean rdx for division*/
	mov	$10,%r10
	div	%r10
	mov	%rdx,%r12	/*preserve remainder into r12*/

	mov	%rax,%r14
	add	$'0',%r14b
	cmp $'0',%r14b
	jne out
	mov $' ',%r14b
	
out:
	mov 	$msg,%r13
	add	$0x6,%r13
	mov	%r14b,(%r13)
	
	mov	%r12,%r14
	add	$'0',%r14b
	mov $msg,%r13
	add	$0x7,%r13
	mov	%r14b,(%r13)
	/* end of mangling*/

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


    inc     %r15                /* increment index */
    cmp     $max,%r15           /* see if we're done */
    jne     loop                /* loop if we're not */

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

.section .data
msg:	.ascii      "loop:   !\n"
	len = . - msg

and aarch64

.text
.globl _start

start = 0
max = 30


_start:
    mov      x15,start         /* loop index */

loop:
	 
	mov	x20,x15		/*copy the count*/
	
	mov	x21,10		/*store 10 in a register*/
	udiv	x19,x20,x21	/* store quotient in x19*/
	msub	x22,x21,x19,x20	/*stores remainder in x22*/
	

	add	w19,w19,'0'
	add     w22,w22,'0'


	/* suppression of leading 0*/
	cmp	x19,'0'
	bne	skip
	mov	x19,' '


skip:   
	adr     x13,msg
	strb    w19,[x13,6]	/*tens digit*/
	strb    w22,[x13,7]	/*ones digit*/
        
	
	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 */


	add     x15,x15,1                /* increment index */
    	cmp     x15,max           /* see if we're done */
   	b.le    loop                /* loop if we're not */
 
	mov     x0, 0     	/* status -> 0 */
	mov     x8, 93    	/* exit is syscall #93 */
	svc     0          	/* invoke syscall */
 
.data
msg: 	.ascii      "loop:     !\n"
len= 	. - msg

Simply beautiful..I know it may sound sarcastic but believe me, I actually had a lot of fun getting this to work in assembler, and once for each architecture. I think that this was a nice exercise in getting a feel for how the machine operates in each of the 2 architectures, it also highlights how much easier higher level programming languages makes it to write code that does more things in less time (to write the code). A simple for loop, and even the suppression of the leading 0 of an int we often take for granted, and it is a fun experience to have to handle it manually in this exercise.

On top of realizing the amount of heavy lifting that one does not have to do when using a higher level programming language than assembly, the differences between the two architectures we coded for in this lab was also important. In particular I found that although Aarch64 is a RISC (Reduced instruction set computing), that the ability to specify the offset to be very handy.

I am referring to this:

strb    w19,[x13,6]

While Division is a 1 step process in x86_64, I can’t say I dislike aarch64’s way of doing it, msub and madd can be pretty useful instructions later on.

	div	%r10
	mov	%rdx,%r12	/*preserve remainder into r12*/

vs

udiv	x19,x20,x21	/* store quotient in x19*/
	msub	x22,x21,x19,x20	/*stores remainder in x22*/

I do have to note that sometimes it gets confusing switching between architectures, and the syntax of operands, source and destination registers being flipped, as well as functions having different names (jumping vs branching), (jeq, je, beq, be).

Lastly, to comment about the debugging process. For a program like this which is tiny in size, and one person writes all of it and can have the whole program understood in his head, its not so bad. Imaging multiple people writing parts of a program in assembly, then merging it all together. Debugging that becomes a nightmare.

Moreover, due to the nature of assembler, it is quite often that it takes a couple of lines to accomplish one logical step. As such; understanding the bigger picture becomes harder when debugging assembly line by line compared to other programming languages. However there are times when assembly is able to perform operations much faster due to bitwise operations and when space to store instructions is limited.

Until next time :D


by pyourk at October 02, 2014 10:32 PM


Gary Deng

OSD600 0.1 Release

The first project I worked in my open source development course is Filer which is a POSIX-like file system interface for Node.js and browser-based JavaScript. Filer is very much similar to node.js fs module, but Filer has some other features lacking in node.js. My task is to add “du” command to shell. The “du” would help user to know how much space a filesystem is occupying in storage. As we all know that Unix has a way to do this already with “du”.

By default, the du utility shall write to standard output the size of the file space allocated to, and the size of the file space allocated to each subdirectory of, the file hierarchy rooted in each of the specified files. By default, when a symbolic link is encountered on the command line or in the file hierarchy, du shall count the size of the symbolic link (rather than the file referenced by the link), and shall not follow the link to another portion of the file hierarchy.

How did I accomplish my task?
Step 1:
Log in my Github account, go to https://github.com/filerjs/filer, click the “fork” button on the top right of the page to fork this project to my account. Now I have the most up-to-date copy this project.
Step 2:
Clone the project to my computer:
git clone git@github.com:GaryDeng/filer.git

Step 3:
Set up my develop environment:

Step 4:
Read through all the documentation and try to understand the project, play around with the source code, and run the test.

Step 5:

Research, research, and research, if you are lucky enough, you would be able to find similar solution to solve your problem. At least, you could be inspired by other programmers’ approach to solve identical problem. I am lucky enough to find a very similar implementation in the same project. The “ls” command in this project is exactly what I need.

Step 6:

Create a new branch, start to write test cases and implement it

Finally, commit my codes and push to my Github account, and send pull request against my professor’s Github reopsitory.


by garybbb at October 02, 2014 07:36 PM


David Humphrey

How to encourage contributors

One of the techniques I've used over the years in teaching open source is to invite core members of the projects we're working within to come and give guest lectures. I do this for a variety of reasons. First, I find that students are intimidated by the size and complexity of big open source projects, and having a person who looks and sounds just like them at the front of the room saying, "You can do this," is invaluable to building their confidence. Second, I like to let the passion and excitement of the community spill into the classroom, and hopefully light a fire--the people I invite are always very interesting to hear when they get to describe their work, tools, workflows, etc.

Yesterday I was lucky to have Kate Hudson come and talk about Mobile Webmaker, a Firefox OS and Android mobile web app for creating mobile web apps (mobile web inception!) that can be shared and installed over SMS. I like the global feel of the project, and the fact that it seeks to bring the best of the web (i.e., being able to create things that matter to small groups of people vs. just consuming corporate mega-apps). My students are from all different countries and represent many different cultures and languages. How can you not love a project that has bugs about enabling mobile apps for use cases like a salsa teacher in Kenya who needs to share news and salsa party info via SMS? Honestly.

Kate's always fun to listen to, because she's so engaged with her work, and has such creative approaches to UX, complex coding problems, etc. I think the students were blown away seeing her workflow using Firefox Nightly and the WebIDE. Another thing I noticed that I thought was a good takeaway for people who want to engage contributors to their projects was the level of commitment to onboarding new devs. We all know that READMEs and other docs are important for new contributors, but Kate's taken it one step further and written an online book about the project and how things work. That's pretty rare and amazing, especially for students and new developers.

If you're a teacher trying to get your students involved in open source projects, reach out to the devs and set up some guest appearances. If you're an open source project seeking the involvement of the academic community, take the time to go and visit the students, invest in appropriate levels of documentation.

It was amazing to watch the students realize the opportunities that exist for them to pair their skills as developers with the needs of the project. "Could I add a map component?" Sure! "What if it supported drag-and-drop with touch?" Do it! "How about support for users in Brazil?" Yes! As open source projects I think we often assume that if you build it, they will come; some people will find you that way, for sure. But there are so, so many more people who won't find you that way, and to be honest, these are the people you need in your project, with their diversity of experiences, skills, and backgrounds. Want your project to be different from all the others? Invest in getting new kinds of people involved. That's what Kate's doing.

by David Humphrey at October 02, 2014 03:59 PM


Chris Tyler (ctyler)

You'd be crazy to miss FSOSS 2014


The Free Software and Open Source Symposium (FSOSS) 2014 is around the corner, and it's shaping up to be the best in years. We have well over 30 talks spread over 2 days, covering just about every corner of open source from new and upcoming technologies through business models. We have a keynote from my colleague David Humphrey examining the implications of Heartbleed, as well as keynotes from Chris Aniszczyk (Twitter) and Bob Young (Lulu/Red Hat/TiCats). There are speakers from Canada, the US, Hungary, the UK, Cuba, and India, representing open source communities, academia, entrepreneurs, startups, and companies such as Mozilla, Cisco, AMD, Red Hat, and Rackspace.

Until October 10, registration for this event is just $40 (or, for students and faculty of any school, $20), which includes access to all of the keynotes, talks, and workshops, two lunches, a wine/beer/soft drink reception, a t-shirt, and swag.

Full details can be found at fsoss.ca -- see you October 23/24!





by Chris Tyler (nospam@example.com) at October 02, 2014 03:31 PM

September 30, 2014


Edwin Lum

Investigation into aarch64 registers

This week in the spo600 class, we started looking into different computer architectures, namely, x86_64  and aarch64. My presentation was regarding the aarch64 registers, and to investigate special functions and/or uses that some of these may have.

First and foremost, aarch64 registers are more simply named. aarch64 has 32 registeres, named r0 all the way to r31 when referred to by humans.

These same registers are referred to differently when accessing them as a 32 bit register versus a 64 bit register. w0-w31 for 32 bit, and x0-x31 for 64 bit. simple and straight forward, right?

The above registers are intended for integer operations, there are another set of registers that are more efficient for floating point operations and SIMD (Single instruction Multiple Data). SIMD is especially useful when dealing with multimedia operations that usually have the same instruction that has to be executed on many data points (such as adjusting the brightness of each pixel on the screen).

During a system call, note the following (1):

Usage during syscall/function call:

  • r0-r7 are used for arguments and return values
  • For syscalls, the syscall number is in r8
  • r9-r15 are for temporary values (may get trampled)
  • r16-r18 are used for intra-procedure-call and platform values (avoid)
  • The called routine is expected to preserve r19-r28
  • r29 and r30 are used as the frame register and link register (avoid)

For the Aarch64 architecture, register 31 in particular has the following special properties.

Register ’31’ is one of two registers depending on the instruction context:

  • For instructions dealing with the stack, it is the stack pointer, named rsp
  • For all other instructions, it is a “zero” register, which returns 0 when read and discards data when written – named rzr (xzr, wzr)

 

To me, this is a very useful thing to have. In particular I would imagine using r31 to “zero” other registers and/or contents of memory locations without having to provide an immediate value. This is of particular importance because of the fixed instruction length of Aarch64. One problem that we will run into with aarch64 is that sometimes we will want to specify an immediate value that is too large to fit into a single instruction, which needs to be sidestepped. Having a reliable register that returns 0 just makes things simpler since this is probably an operation that is often performed.

 

References

ZENIT.SENECAC.ON.CA

Aarch64 Register and Instruction Quick Start – Open Source@Seneca

In-text: (Zenit.senecac.on.ca, 2014)

Bibliography: Zenit.senecac.on.ca, (2014). Aarch64 Register and Instruction Quick Start – Open Source@Seneca. [online] Available at: http://zenit.senecac.on.ca/wiki/index.php/Aarch64_Register_and_Instruction_Quick_Start .


by pyourk at September 30, 2014 01:02 PM


Frank Panico

JSHint here I come

I just enabled everyone’s favorite (or at least my favorite) text editor Notepad++ with JSHint. This should help to check Node.js javascript code. Check out how to do it here!

http://willperone.net/Code/codejshint.php


by fpanico04 at September 30, 2014 02:26 AM


Kieran Sedgwick

[SPO600] An overview of the x86 architecture and its registers

I was tasked with putting a presentation on the x86(LINK) architecture’s registers, along with an explanatory blog post on the topic. In particular, I had to focus on the 64 bit version of the architecture, called x86_64.

x86 is at once modern and a history of CPU architecture. Its strength and weakness is found in how it maintains significant backwards compatibility by building on top of, rather than removing, features found in older iterations of the hardware. This is most obvious in the names of the general registers, which we will see in a moment. The architecture uses variable length instruction sets, and was designed for CISC instructions in particular.

General Registers

The x86_64 architecture provides sixteen general purpose 64-bit registers for use in five access modes. These access modes allow smaller values to be loaded into them, and allows earlier software to use the modes they were originally compatible with.

The backwards compatibility’s historical relics are visible in the choice of names for the registers:

  • ax-dx (4)
  • bp, sp (2, base pointer & stack pointer)
  • si, di (2, source & destination indexes)
  • r8-r15 (8, added for x86_64)

It is worth noting that, with the exception of certain operations, the registers can be used interchangeably.

The five access modes are:

  • 64 bit (prefixed with ‘r’), e.g. rax, r8
  • 32 bit (prefixed w/ ‘e’, or suffixed w/ ‘d’)
  • 16 bit (no prefix, or suffixed w/ ‘w’)
  • 8 bit (top of 16 bits, suffixed w/ ‘h’), e.g. ah
  • 8 bit (bottom of 16 bits, suffixed w/ ‘l’ or ‘b’)

XMM Floating Point Registers

In addition, the architecture provides eight 128-bit registers for floating point calculations, named XMM0 through XMM7. They are used for storing single and double floating point values during floating point calculations.

Segment Registers

To my understanding, segment registers hold pointers to memory locations in an effort to prevent a buffer overflow in a segmented memory management scheme. In today’s 64 bit processors, this is considered obsolete and is used for backwards compatibility.

EFLAGS Register

Each bit in this 32-bit register represents a flag of some kind, and is used to keep track of state between instructions without the use of memory. Interestingly, this register is somewhat futureproofed by keeping some bits reserved for future iterations of the architecture that might require new flags.

Conclusion

This has been exciting to explore, since it is the part of computer science I am least familiar with. There is still much to learn!


by ksedgwick at September 30, 2014 12:33 AM

September 29, 2014


Fadi Tawfig

Implementing du in Filer

So for my OSD600 course the first assignment was to implement the du command in Filer, a node.js POSIX file system. Due to a very busy week and my total newness to this style of programming, I’m submitting this assignment slightly late.

At first everything seemed to be going quite well. I could get the size of a file just fine. Same with a simple directory with a couple of files in it. The issues arose when I tried to call my du function on a nested directory tree.

The major issue I had was wrapping my head around the use of asynchronous callbacks when used together with a recursive function such as du. Although my first attempt at calculating the disk usage of a directory did get the correct size of the directory, by the time the function was finished summing up the total usage, du had already returned to the test and reported the size of the directory to be 0 causing the test to fail.

Seems like my head is still stuck in traditional object oriented style programming languages such as java. My first attempt to loop through the entries in the directory was using a for loop. This didn’t work because by the time the loop was finished executing the function already called it’s callback and the test had failed. After looking to the ls command for guidance (a very helpful command for this assignment due to its use of recursion) it seemed that the answer was to use the function async.eachSeries(). eachSeries() takes three parameters, a collection, an iterator and a callback. It then calls the iterator function on each item in the collection in sequence. This ensures that the grand total is calculated before returning to the test.

It’s clear I have a lot more practice to do with this style of javascript programming. Although it can cause some frustration at times there are a lot of things I like about it. Most notably high readability aspect. I’ll continue to read up and practice my javascript for the next release.

Pull request here.

- Fadi


by ftawfig at September 29, 2014 11:37 PM


Lukas Blakk (lsblakk)

New to Bugzilla

I believe it was a few years ago, possibly more, when someone (was it Josh Matthews? David Eaves) added a feature to Bugzilla that indicated when a person was “New to Bugzilla”. It was a visual cue next to their username and its purpose was to help others remember that not everyone in the Bugzilla soup is a veteran, accustomed to our jargon, customs, and best practices. This visual cue came in handy three weeks ago when I encouraged 20 new contributors to sign up for Bugzilla. 20 people who have only recently begun their journey towards becoming Mozilla contributors, and open source mavens. In setting them loose upon our bug tracker I’ve observed two things:

ONE: The “New to Bugzilla” flag does not stay up long enough. I’ll file a bug on this and look into how long it currently does stay up, and recommend that if possible we should have it stay up until the following criteria are met:
* The person has made at least 10 comments
* The person has put up at least one attachment
* The person has either reported, resolved, been assigned to, or verified at least one bug

TWO: This one is a little harder – it involves more social engineering. Sometimes people are might be immune to the “New to Bugzilla” cue or overlook it which has resulted in some cases there have been responses to bugs filed by my cohort of Ascenders where the commenter was neither helpful nor forwarding the issue raised. I’ve been fortunate to be in-person with the Ascend folks and can tell them that if this happens they should let me know, but I can’t fight everyone’s fights for them over the long haul. So instead we should build into the system a way to make sure that when someone who is not New to Bugzilla replies immediately after a “New to Bugzilla” user there is a reminder in the comment field – something along the lines of “You’re about to respond to someone who’s new around here so please remember to be helpful”. Off to file the bugs!

by Lukas at September 29, 2014 06:24 PM


Andrew Li

Release 0.1

For the first release we were given the option to either find a bug or implement the du shell command in Filer. The follow post is a summary of what I learned.

I choose to implement the du command and here is my pull request. Here is my work in progress.

Setting the dev environment

The first step was reading the CONTRIBUTE.md file in GitHub and then forking the project. After forking, a copy was cloned onto my local machine.

git clone git@github.com:liandrew/filer.git

To run the tests, grunt was installed using NPM

npm install -g grunt-cli

After installing grunt ensure dependencies for the project are installed. I forgot to do this so I couldn’t run grunt test.

npm install

Run the tests with

grunt test

After passing all tests I was ready find out more about the du command.

Understanding the bug

In the past I’ve used du to find an estimate of how much space a folder was occupying and for doing quick sanity checks. After reading more on du I found that I had to get the follow to work:

1. return sum total of all sizes for all files in directory recursively
2. return depth-first list of all entries in the directory followed by the directory itself

Using 1 and 2 as test cases sounded right so I programmed what I thought I should see. At first it seemed really strange to write the test cases first but doing it first actually makes sense - it helps with understanding the problem.

Using the specs outlined in Implement du shell command #277 as a guide, I copied the ls command since it’s similar and started to fiddle with it to learn. Putting callbacks and closures into practice took a bit of getting use to. It was hard to follow what was going on in ls since I didn’t have a good understanding of the callback pattern. So I backtracked, went to the web and read a few helpful blog posts on callbacks and then practiced writing a few examples of my own. Other questions that popped up after looking at the ls code:

Using Git is Awesome

Using Git I was able to easily go back and forth between branches and revert code on the fly. I found these commands useful:

Create a new branch from a previous commit

git branch <branch name> <hash>

When things go bad I found this useful for going back to a clean copy of the last commit

git checkout .

Conclusion

I’ve learned a lot through the process of getting from setting up a dev environment to implementing code. Test #2 failed, I was able to return the list in depth-first order but had trouble adding the current path to the end without messing up the callback. I will try to revisit this and reach out to the community and fellow students for help. I definitely need more practice with callbacks and closures. For the next release, I will try to reach out to the community more often, be active on irc to try to help and get help from the community.

September 29, 2014 12:00 AM

September 28, 2014


Yasmin Benatti

Du command Filer Implementation

The first release we had to do on the Open Source class was to implement the du command on Filer. Filer is “a POSIX-like file system interface for node.js and browser-based JavaScript”. You can find the filer project here and the issue we worked on here.

Du is a Unix command that shows the disk space usage for a specific file or directory. There are two manual commands that I used to help me, the GNU one and the Open BSD. You can also find the link for the Apple implementation of the  du command .

My mainly thought after doing this first release is: working with open source and programming is hard! Also it is really challenging, in a way that puts you against yourself and makes you want to find the answer no matter what. I am also learning to program in JavaScript what makes really hard to work in something that big. Luckily, I had someone that helped me a lot! Kieran is a classmate that taught me all the proceeds to set up my machine, how to look for a piece of code, how to reuse the code, how to use Git, Github and anything else I had to do in this project.

During the process to write the tests I and Kieran fond that when using the du command on Matrix and on Mac OS, the results were different. I searched about file systems, block usage and how different implementations of the du command works. The implementation from GNU and Open BSD are slightly different, but what makes the results not match is probably the file system and how directories are created and managed by the OS.

The implementation I did can be found here, but it is not complete. I did just the tests and even this is not complete too. That is because I’m taking this course, even tough it’s much forward in the course and I’m not dominating JavaScript. Anyway, it’s being a very good learning for me and I’m getting in touch with all these tools.

The tests I did involve verifying if the du command (working more as the ls -l command) returns the right size of the file when running without a specified path, on a specific file, on and inside an empty directory, on and inside a directory with a single file and on and inside a directory with multiple files.

Hope to be able to finish it by myself soon!

Cheers.

by yasminbenatti at September 28, 2014 03:27 AM


Glaser Lo

Release 0.1

As a rookie of node.js programming, I encountered lots of problems at the beginning.  The first thing confusing me is the callback structure of node.js programming.  While most of my previous experiences are on procedural programming, learning asynchronous program is a new challenge to me.  For instance, node.js program doesn’t run from top to bottom.  Instead, it involves lots of asynchronous functions to avoid disk I/O or network I/O slowing down the main process.  Therefore, even though there are code files in the project for references, it still takes me some time to recognize the place where I should put my custom code in.  Another issue I encountered is came from the build/test tool – grunt.  Honestly, I had no idea about grunt.  It seems to be a build tool like ant and gradle, but the thing is I am failed to find the way to run debugger when testing.  I end up spending a lot of time on testing.  There are also some minor issues about javascript.  Unlike c++ or java, dynamic data types in javascript cost me a bit of time to figure out variable types.  Overall, after the release 0.1, I can feel that I learned a lot about node.js and open source cultures.  Thanks to the help from my professor Dave and my friends who attended the class.


by gklo at September 28, 2014 03:19 AM