Expectations

I am looking forward to working on this open source project! I am very excited to see how we can develop the project as a team and maybe make a real world impact. I am a big fan of open source projects, I use them at work daily and at home as-well. I have never worked on an open source project and I cannot wait to get started on this one!

From the blog tbruceblog » cs401 by tbruce731 and used with permission of the author. All other rights reserved by the author.

What I’m Expecting..?

Well, this is probably shaping up to be the first computer science class the most involved with things to do outside the classroom. Never really had a blog or anything else to that nature before starting this class, so that’s probably going to cause me some headaches.

What am I expecting out of the course itself..? Well, I generally try to go into things with an open outlook, so I can’t really say I’m “expecting” anything. We’ll just have to see how things go. There seems to be a good amount of expected reading to start with, at least.

What I expect to take away from the course..? Probably something along the lines of ‘a better understanding of the greater world of computer science and how programmers and developers get in touch and interact with one another in an open environment’. Well, something like that. I never claim to be the best at putting thoughts into words.

All in all, it’s shaping up to be an interesting experience, all things concerned. Let’s see what we can learn…

From the blog Kyle's Works » CS@Worcester by kyleprimmer and used with permission of the author. All other rights reserved by the author.

Course Expectations, Reading Assignments, Git Activity and IRC Activity

My expectations of this course is to gain a solid foundation on the complete developmental lifecycle of a piece of software along with the legalities surrounding the licensing or freedoms that go along with it. I have previous experience in Agile/Scrum so I would like to build upon those previous experiences of being part of a development team and I also intend to become an active member of the OpenMRS community.

I enjoyed reading the three articles. In the article the Cathedral and the Bazaar, I felt that Mr. Raymond focused more on the bazaar methodology and his transformation of popclient to fetchmail. Although Mr. Raymond makes valid points about the Bazaar methodology and its ability to produce software that is robust and cutting edge by releasing early and often and having many sets of eyes analyzing a particular problem which in turn lead to less buggy software. I believe it is also necessary to have proprietary software. I think having closed software creates a healthy competition between companies to expand and advance their software while at the same time supplying hundreds of thousands with jobs. In one of Mr. Raymond’s quotes he stated “Too often software developers spend their days grinding away for pay at programs they neither need nor love.” Well, too often carpenters spend their days grinding away for pay building houses they neither need nor love, but they do it because it’s their source of income. Unfortunately millions of Americans are unable to work on projects of passion during business hours. In the Free vs. Open readings, I was impressed with the clarity of the Free Software Definitions. With that set of freedoms you can see why a piece of free software has the ability to develop at an exceptional rate and quality. One thing I don’t understand about free software is the ability to receive a copy of software, modify that software to fit your needs and then sell your modified software for a monetary value. I understand the saying you should think of “free” as in “free speech,” not as in “free beer”., but if some people pay while others don’t pay for the same software it seems to be a little confusing and misleading. The first four chapters of the OpenMRS development guide was a great introduction on what OpenMSR is and what OpenMRS’s goal is. Open source projects like this one that have a humanitarian goal must be very fulfilling to those who contribute. It seems to be a win/win for all parties. For the patients themselves they now have the ability to have their medical information in a central place where it can be accessed, monitored and updated. It also benefits the patient by less medical mistakes where hand- written physician records are misinterpreted and incorrect medication is provided to a patient. For the software users in the hospitals and clinics it gives them the opportunity to become more accurate and efficient when entering or retrieving patient data. For the developer they get to contribute to a piece of software that can truly make an impact on millions of lives.

I have heard of IRC but have yet to actually make use of it, so I am looking forward to using it. While I was working at MasterCam CNC Software Inc., if a team meeting were taking place over the internet we would generally use Skype or some form of Go to Meeting. Skype was great because you could easily embed code snippets right into the textbox for your group to see. It was also great for quickly sending files and links to team members.

The Git activity was interesting. Using the Git Bash felt a little foreign to me. I’ve used version software before called TortoiseSVN. TortoiseSVN came with a pretty polished GUI that made finding and handling conflicts on large files a breeze. Push, pull and commit were also simple. I liked the way it displayed and highlighted conflicting areas of the files side by side, which could make a real stressful commit a little less stressful. I’ve also noticed that Git comes with a GUI so I think I will use that feature while working on OpenMRS.

From the blog mlopatka by matthewlopatka and used with permission of the author. All other rights reserved by the author.

First Week, CS-401

Well then, the OpenMRS is certainly a very large and interesting project to say the least.  But with such a large and ongoing effort to provide an Open Source EMR database one is immediately struck with the question.  “What could (what I consider) a novice programmer possibly contribute to such a large ongoing effort?”  The upcoming few months will certainly answer that question without doubt.  As for the time being, I am very excited to be working (soon) be working and contributing to the OpenMRS community.

My expectations of this course are already set quite high, with the hopes of simply becoming a much more savvy programmer.  My only regeret is not being introduced to such sources as GitHub and exposure to other open source projects sooner, but that cannot be helped at this point in time. On that topic, over the Eric S. Raymond’s article The Cathedral and the Bazaar have also opened me up to the raw potential  — and how powerful open source communities can be.  Maybe my current inexperience will still be of good use to the OpenMRS project after all.

From the blog aboulais » CS WSU by aboulais and used with permission of the author. All other rights reserved by the author.

Git Activity

I thought that the git activity was interesting. I have been doing tons of work through the command line and liked that it could be done that way. Almost everything seems quicker and easier to do through the cli then a gui now.

From the blog ckelley6 » CS401 by ckelley6 and used with permission of the author. All other rights reserved by the author.

Rafter Maker an Android and iOS Project

This will be the first of many blogs this semester explaining the progress and discoveries I have made during the development of my app.  My task, simply put, is to develop an application for Android which can be used to create roof rafter templates and generate specific instruction sets at run time.  I then intend to convert the Android version to iOS. I will be covering the most basic of roof applications for the first version.  It will will include shed, gable, hip, and gambrel rafters as well as gable and shed dormers.  Fascia and soffit will be handled as well, but they will be integrated into each template – due to their dependence upon the roof angle or pitch. The templates will be the main function of the app, but I will work to also include detailed instruction sets regarding roof construction.  

 Once that is accomplished, I will publish the app to the Google Play Marketplace as a free beta for a minimum of thirty days.  Hopefully, my users will find any bugs that have eluded me.  I plan to test all of the template algorithms with JUnit for Android and OCUnit for iOS, so there should be no bugs within those methods.  When the app is published I will begin working to convert it app to iOS.  I have done some preliminary research on developing for multiple platforms and despite there being softwares like Phone Gap and Titanium, I have decided to code the Android and iOS apps separately in native code.  My thought is, I will not need to put as much effort into the iOS version because the app content will already be completed, and also by coding natively my app will have OS specific look and feel.  In theory, I will just have to rewrite the code in objective-C though I am sure there will be plenty of problems along the way due to the major differences between Android and iOS app structure.  

 Upon completion of the iOS app, I will publish it to the Apple App Store as a free beta for a thirty day minimum.  Once the apps come out of beta, I will make them available for a fee in both marketplaces.  I had considered embedding advertising into the apps and offering them for free, but the market for construction apps is so narrow I have decided against that.  However, if I was marketing to children – who seem to love clicking anything and everything I would most certainly have made it free and embedded advertising.  

 With so much work to do I decided to begin early before the start of the semester.  I actually will be starting with a half finished android application.  I have a completed the shed rafter template and embedded the fascia soffit calculations into its process.  I also created a separate UI for tablets so the extra screen real-estate will be properly utilized. The app will support Android version 2.2 and newer, but there may be some limitations on small screen sizes.

 I will be blogging later in the week about some of the more difficult challenges I have encountered thus far.  There will be some screen shots of the phone interface vs the tablet as well.  Once the Android app is complete and I will begin coding in iOS; I will focus some of my blogs on the the differences between developing for both platforms. 

 Till next time.

 Jason Hintlian

From the blog jasonhintlian » cs-wsu by jasonhintlian and used with permission of the author. All other rights reserved by the author.

A Cooperative REPL Server for Guile 2.0.10

The next release of GNU Guile, 2.0.10, is to be released "real soon
now". My contribution to this release is the new (system repl
coop-server)
module. This module introduces a useful variant of the
REPL server that I’ve named the "cooperative" REPL server. It is
cooperative because it can be integrated with single-threaded programs
without the thread synchronization issues present in the ordinary REPL
server.

Using delimited continuations and mvars (another new feature coming in
Guile 2.0.10), it was possible to create a REPL server whose clients
all ran in the context of a single thread. The cooperative server
puts the user in control of when it is safe to evaluate expressions
entered at the REPL prompt.

Here’s an example of how to use it:

(use-modules (system repl coop-server))

(define server (spawn-coop-repl-server))

(while #t
  (poll-coop-repl-server server)
  (sleep 1))

That’s all it takes. There are only 2 public procedures!
spawn-coop-repl-server creates a new cooperative REPL server
object and starts listening for clients. poll-coop-repl-server
applies pending operations for the server.

Now that I’ve explained the API, onto the implementation details!
Although the REPLs run in the context of a single thread, there are
other threads needed to make it all work. To avoid thinking too much
about thread synchronization issues, I used the new (ice-9 mvars)
module to provide thread-safe objects for read/write operations. I
used delimited continuations in order to yield control back to the
user from inside the loop.

When the server is spawned, a new thread is created to listen for
client connections. When a client connects, a request to create a new
REPL is put into the server’s "evaluation" mvar, the storage place for
pending server operations. The job of poll-coop-repl-server is to
attempt to take from the evaluation mvar and execute the operation
stored within, if any. In this case, an operation called new-repl
is hanging out along with the client socket. The contents of the mvar
are removed, and a new REPL is started in the main thread.

This new REPL is run within a "prompt", Guile’s implementation of
delimited continuations. The prompt allows the REPL to be paused
temporarily while waiting for user input. Just before the prompt is
aborted, a thunk containing the logic to read user input is stored
within the client’s "read" mvar for yet another thread to use.
Without this additional thread and the use of a prompt, the main
thread would block while waiting for input, defeating the purpose of
the cooperative REPL. The reader thread waits for this thunk to
appear in the read mvar. When it appears, the thunk is applied and
the resulting expression is stored as an eval operation within the
evaluation mvar. When poll-coop-repl-server is called, the REPL
prompt is resumed. The input expression is evaluated in the context
of the main thread, the result is printed, and the process repeats
itself.

That’s all, folks. Thanks for following along. I’m very excited to
use the cooperative REPL server in guile-2d and I hope that others
find it useful as well. Many thanks to Mark Weaver for helping me out
when I got stuck and for all of the helpful code review.

From the blog dthompson by David Thompson and used with permission of the author. All other rights reserved by the author.

Syncing Required Packages in Emacs

I use Emacs on several different computers. To keep my configuration
consistent across all of them, I do what many people do and made the
~/.emacs.d directory a git repository. I don’t like to keep
copies of all of the Elisp extensions that I use, such as paredit and
geiser, in this repository. Instead, I prefer to use package.el
(introduced in Emacs 24) with the MELPA repository. This saves me
from having to manually keep all of the extensions I use up-to-date,
but requires another method to keep useful packages in sync between
computers.

There’s a project called Pallet that solves this problem, but it was
too heavy for my liking. Instead, I wrote a short function that
simply iterates over a list of required packages and installs those
that are not currently installed.

;; Additional packages that I use.
 (setq required-packages
       '(better-defaults
         elfeed
         geiser
         ido-ubiquitous
         js2-mode
         magit
         paredit
         rainbow-delimiters
         smex))

 (defun install-missing-packages ()
   "Install all required packages that haven't been installed."
   (interactive)
   (mapc (lambda (package)
           (unless (package-installed-p package)
             (package-install package)))
         required-packages)
   (message "Installed all missing packages!"))

Now, it’s as easy as typing M-x install-missing-packages RET when
starting Emacs for the first time on a new computer to download all of
the extensions that I need. Note that before calling
install-missing-packages you must have already initialized the
package manager via the package-initialize function. This
approach does require some manual bookkeeping in order to keep the
required-packages list up-to-date with your workflow, but I
haven’t found it to be problematic.

Update: If this solution is too simplistic for you, you should check
out use-package, which reddit user lunayorn pointed out to
me. Thanks!

Check out the comments on reddit.

From the blog dthompson by David Thompson and used with permission of the author. All other rights reserved by the author.

Code Break: GitLab API Part 1 – Creating student accounts

Now that we have the CS Department’s GitLab server set up, and CS-140 Lab 1 is rewritten and tested using the new server, I’ve started to think about how to automate my interactions with the server. I had already  written some Bash scripts to interact with the Bitbucket server to get student code, convert it to PDF files, and put it back on the server after grading. Those scripts should still work fine with GitLab, since it’s just git on a different server.

One thing that I had not been able to automate previously is the step of issuing a pull request for students to merge my grading branch into their repository. This was not too much of an issue when there were only 6 students in the summer class (so only 3 repositories per lab assignment), but it was going to take more time with ~48 students in the spring class. While reading RSS feeds, I came across a post mentioning the GitLab API. This could be the solution to my problems! And there’s a Python module for the API! I had already been writing Python scripts to make my grading easier, and had been starting to rewrite my Bash scripts in Python.

I started playing with the GitLab API in Python, and had managed to create a merge request (GitLab’s term for pull request.) I had also noticed that you could create GitLab accounts through the API. This seemed like something I should pursue – creating ~48 accounts per semester seemed like something that should be automated.

Since I intended to post my code on Github, one of the first issues I had to address is how to avoid publishing my private token for GitLab. I could have put in a dummy token before pushing my code, but I would have to remember to do that before every time I committed my code. The solution to this issue was solved through the use of the .gitignore file. If I put my token into a file, then I could add a line to my .gitignore file so that it would not be committed.

# Private GitLab Token - not to be stored in repository #
########################################################
gitlabtoken.txt

Then I could just read the token out of the file, and use that string.

# Get my private GitLab token
# stored in a file so that I can .gitignore the file
token = open('gitlabtoken.txt').readline().strip()

After importing the pyapi-gitlab module, I could use that token, along with the server’s URL to create a GitLab object. Notice, that I had to turn ssl verification off, since we only have a self-signed certificate.

# Create a GitLab object
# For our server, verify_ssl has to be False, since we have a self-signed certificate
git = gitlab.Gitlab(GITLAB_URL, token, verify_ssl=False)

Creating a user account is pretty simple using the API:

# Create the account  
success = git.createuser(name, username, password, email)

The returned success value is a boolean — either it worked, or it failed (but you can’t tell why…).

One thing that’s a bit odd about the createuser call, is that you have set a password for the user, but the notification email to the doesn’t include the password. (If you create a user account from the web interface, it generates a random password, includes it in the notification email to the user, and requires the user to change their password when first logging in.) And, the password you set doesn’t seem to work either!

So, I’m just telling the students that they should use the “Forgot Password” link to have a password reset email sent to them, and then proceed from there. (If this is ever fixed, I’ll have to generated a random password.)

Getting the class list as a CSV file from the Blackboard Grade Center is pretty easy, and the first three rows contain the student’s last name, first name, and username. I can use those three strings to generate the name, username, and email needed for the createuser API call.

The only challenge with processing the CSV file is that Blackboard puts some strange character at the beginning of the file, so the file has to be opened with utf-8 encoding. (And the header line needs to be thrown away.)

The last thing I wanted to add is a way to have optional verbose output, so that I could see if the user creation was working. (I decided that it should always notify the user if the account creation failed.)  To do this I had to learn two new things about Python: how to parse arguments1, and how to send output to stderr.

I used the argparse module:

import argparse
# Set up to parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='Blackboard CSV filename with user information')
parser.add_argument('-v', '--verbose', help='increase output verbosity', action='store_true')
args = parser.parse_args()

and used the verbose argument to determine what to print:

if not success:
    sys.stderr.write('Failed to create acccount for: '+name+ ', '+username+', '+email+'\n') 
elif args.verbose:
    sys.stderr.write('Created account for: '+name+', '+username+', '+email+'\n')

Full code is on Github here.

  1. I already knew how to do simple argument parsing, but I wanted to learn how to deal with optional arguments. ↩

From the blog On becoming an Eccentric Professor... » CS@Worcester by Karl R. Wurst and used with permission of the author. All other rights reserved by the author.

Jump to Jasmine Specs with Rinari

I use the rinari Emacs mode to assist me when working on rails
projects. One of rinari’s most useful features is the ability to
quickly jump from one file to another related file. I use this
feature almost exclusively for jumping between a ruby class file and
its associated rspec file, but lately I’ve been spending most of my
time writing javascript. At VHL, we use jasmine for our unit testing
framework and the jasmine ruby gem to integrate it with our rails
projects. Rinari doesn’t have any built-in jump settings for jasmine
test files, so I wrote this quick hack to make it work:

;; Make rinari jump to/from javascript source files and specs.
(setcdr (assoc 'javascript rinari-jump-schema)
        '("j"
          (("app/assets/javascripts/\\1.js" . "spec/javascripts/\\1_spec.js")
           ("spec/javascripts/\\1_spec.js"  . "app/assets/javascripts/\\1.js")
           (t . "spec/javascripts/.*")
           (t . "app/javascripts/.*"))
          t))
(rinari-apply-jump-schema rinari-jump-schema)

Now I can press C-c ; f j to jump between a javascript file in
app/assets/javascripts/ and its jasmine test file in
spec/javascripts/. Perhaps I shouldn’t be overwriting the
predefined (but not very useful) javascript jump settings, but I
really wanted to use the j key.

From the blog dthompson by David Thompson and used with permission of the author. All other rights reserved by the author.