This is my RSS feed. I post general stuff here.


posted Apr 5, 2017, 4:28 PM by Brian Hall   [ updated Apr 5, 2017, 4:30 PM ]

So, I haven't posted in a while. Why? On top of all my responsibilities in life and work, I co-wrote a book. For the past two years, my co-author Kevin Slonka and I have worked diligently on our book Assembly Programming and Computer Architecture for Software Engineers via Prospect Press.

What I found truly amazing throughout the process was the amount of thought, review, and work that goes into a technical book for education. I also find it hard to stop talking about the topics and instructional approach of the book. What we have written is fundamentally different than anything else in this educational space. All the details are on the book website and the code repository.


In other news...I have been approved for a Fall 2017 Sabbatical. The purpose is to explore Haptic programming. I also hope to continue development of my C++ text mining app WordSnapper, which was on hold while writing the book. Moving forward, I plan to post content related to these projects, as well as posts about Assembly/book related work.

Happy coding!

Linking Xcode, C++ and R to create plots

posted May 26, 2015, 7:03 PM by Brian Hall   [ updated May 26, 2015, 7:48 PM ]

Great for Mac/Xcode users who love the computational speed of C++, but also need nice visualizations!

I like C++ and my text mining app is written in C++. The reasons: speed (e.g., file I/O, data structures) and STL. However, one major weakness of C++ is visualization, something R is quite good at if you can figure out all the syntax quirks. So I set out to combine the two in my app for visualization purposes using some prevalent and well-respected packages. Xcode is my chosen IDE. The process was setup-heavy, and took some time digging here and there. I documented the process so that anyone else looking to do the same might find this post helpful. I have also provided a working code example.

- Works on Mavericks (10.9), yet to be tested on Yosemite (10.10)...
- Xcode 6.1.1
- If not installed, install XQuartz (
- If not installed, install R (3.2 or later) (
- Install ggplot2 (this will download a dozen or so packages, all of which need installed)
   You could forego installing ggplot2 and use R's plot() function, but ggplot2 has better aesthetics.
   To install R packages, inside R run:  install.packages("package_name")
   Then in Terminal run:  R CMD INSTALL /path_to_package.tgz

- Add necessary R header files to the Xcode project's header files search path list.
   Project->Build Settings->Search Paths->Header Search Paths
   I recommend using the aliased location:   /Library/Frameworks/R.framework/Headers/
  Or you could go for the literal location such as:
  Alternatively you could copy all of the R header files into your default /include directory.

- Add the R and RInside dynamic libraries to your Xcode project.
  Rcpp does not require a dynamic library.
  I recommend creating a group in your project called dylibs to place any dynamic libraries you may
  need for your project.
  Add the R dynamic library:
  Add the RInside dynamic library:
  /Library/Frameworks/R.framework/Versions/Current(or 3.2)/

- Test it out. Here is a code example (creates myPlot.png on desktop):

#include  <RInside.h>                   // for the embedded R via RInside

int main(int argc, char *argv[]) {
   // create an embedded R instance
   RInside R(argc, argv);
   // demonstrates setting R variables to C++ variables
   std::string outPath = "~/Desktop";
   std::string outFile = "myPlot.png";
   R["outPath"] = outPath;
   R["outFile"] = outFile;
   // build the sequence of R commands as a string
   std::string cmd = "library(ggplot2); "
   "df <- data.frame(column1 = seq(1:10), column2 = seq(1:10)); "
   "myPlot <- ggplot(data=df, aes(x=column1, y=column2, group=1))
    +geom_line()+ylim(0,10); "
   "print(myPlot); "
   "ggsave(filename=outFile, path=outPath, plot=myPlot); "
// run parseEval, passing the R cmd R.parseEval(cmd); std::cin.get(); return 0; }
Due to the cin.get(), the Quartz window will be accessible, but will "pinwheel" until you hit return in the app window.

Communicating with References

posted Mar 10, 2015, 4:55 PM by Brian Hall   [ updated Mar 10, 2015, 4:55 PM ]

The nature of my work means I am often in the position of being a reference for students and colleagues. Students need references for internship positions, study abroad programs, full-time work, campus advising positions, and so on. However, communicating with references is something that seems to be a lost art. What gives?

I constantly receive automated emails asking to complete reference forms for students, but I rarely get asked by email, phone, or in-person if I am willing to be a reference. More and more, students assume that if they have had me for a class or if I am their academic advisor, that I am willing to be a reference. Such an assumption leads students to put my name on a form without first asking if I am ok with being a reference and authorizing them to put my name on the form. Thus, emails trickle into my Inbox stating that so-and-so student is applying for such-and-such position and requests that I complete the reference form by x-date. You get one guess about what happens to that email if I have not been asked by the student prior to receiving the email. You guessed it: ignored or deleted.

The reasons why such emails are ignored should be obvious so I will not belabor the issue. Rather, let me just make a few points about what being a reference means to me, which will make the why clear.

1. I will not be a reference just because I know you, just because I had you in class, nor just because I am your advisor.

2. I will not be a reference if you add my name to a form without my consent, if I receive non-warned emails, nor if you have not asked.

3. I will be a reference if I know you, if I believe you are well-suited for the position, if I feel comfortable associating my name professionally with yours, if you have asked, and if the outcome of our discussion was affirmative.

4. I will be reference if I have had you in class, if you performed to my expectations, if I feel comfortable associating my name professionally with yours, if you have asked, and if the outcome of our discussion was affirmative.

5. I will be reference if I am your advisor, if you are excelling academically, if I feel comfortable associating my name professionally with yours, if you have asked, and if the outcome of our discussion was affirmative.

See a theme?

I am happy to be a reference for my students who are doing well and communicate with me. I recommend you treat all references with the same courtesy and respect. The result will be truthful recommendations instead of ignored emails.


Assembly Syntax Translation

posted Jan 31, 2015, 9:18 PM by Brian Hall   [ updated May 26, 2015, 6:19 PM ]

I wrote this Assembly Syntax Translation document for my students, but I believe it is helpful for a much larger audience including students, professors, and professionals working with assembly code.

The document assists in the translation between GAS, NASM, and MASM assemblers. The document contains some general notes about the three assemblers, some specifics on syntax, and a translation table with statement examples. The document is also available via the Teaching page in the Materials section.

This contains the basics and is enough to get started with translation. However, as stated in the document, refer to it at your own risk.

Installing SASM on a Mac

posted Jan 31, 2015, 8:51 PM by Brian Hall   [ updated Jan 31, 2015, 9:40 PM ]

One of the courses I teach at Champlain College is CSI 370 Computer Architecture, a course in which we discuss and write a considerable amount of assembly. Students can decide which assembler they want to use, which is primarily based on what OS they feel like working in throughout the course. The three assemblers I discuss directly as part of the course are GAS, NASM, and MASM. Personally, I am a Mac user, most of my programming is in C++, and I like Xcode. Packaged with Xcode is the GNU assembler (as or GAS), so I go back and forth between working with GNUas in Xcode and NASM in the terminal environment. 

For the students, Visual Studio is their primary IDE, but VS is limited to MASM and it doesn’t color code assembly. Therefore, many students gravitate to SASM, which is a great multi-assembler IDE for Windows and Linux. SASM allows a programmer to quickly flip between assemblers, debug, inspect registers, and it even color codes assembly…hooray!  

Now, I’m perfectly happy using GNUas in Xcode, but I can appreciate SASM as a tool for writing NASM code and providing a visual debugger. And so I decided I would install SASM on my Mac. But this presents several issues:
* There are not any SASM packages for MacOS, just Windows and a few Linux distros.
* SASM relies on gcc and gdb, and Apple has now moved away from the land of GNU in favor of LLVM and clang.
* I found no evidence that anyone else had tried to install SASM on a Mac, I didn’t look too hard so it may have happened before, but this was a mostly documentation-less process. 

So, I decided to document the steps in case anyone else decides they want to install SASM on a Mac and they go about searching on the Web, perhaps they’ll come across this.

1. Download SASM’s Linux source code from
2. SASM is built on Qt, so if you don’t have Qt, download Qt from
3. Install Qt
4. In order to be able to run qmake, add the following path to your .bash_profile
        PATH=$PATH:/Users/hall/Qt/5.4/clang_64/bin  (with obvious changes for your username and Qt v.)
5. Untar/Unzip the SASM source code you downloaded if you haven’t already.
6. Open Terminal and cd to the SASM source code directory, then run:
        $ qmake
        $ make
        $ sudo make install
7. The SASM .app will now be in the directory, you can move or copy the wherever you want: 
        /Applications for example
8. If you have gdb installed, skip to step 12.
9. If you don’t have gdb installed, the easiest way to install it is via MacPorts or Homebrew. I use MacPorts. If you don’t have MacPorts then download from and install.
10. Then install gdb via Terminal: 
        $ sudo port install gdb
11. By default, MacPorts installs gdb as ggdb in /opt/local/bin/
12. Now we have to create a certificate for code signing since we need gdb to have access to all things System, so create the certificate for gdb. There is no need for me to re-document this step you can review one of these two sites to see how to create this cert.
13. Once created, sign the certificate for gdb: 
        $ sudo codesign -s gdbc /opt/local/bin/ggdb
14. SASM needs to be able to find gdb (ggdb) so you can create symlinks to accomplish this:
$ sudo ln -s /opt/local/bin/ggdb /usr/local/bin/gdb
$ sudo ln -s /opt/local/bin/ggdb /usr/bin/gdb
15. One last thing is that if you want to allow included files in the assembly code then add the “include” folder:
        - Right-click on SASM app, Show package contents -> MacOS/include

If you want the GAS and NASM assemblers to play completely nice within SASM, then you’ll need to go the extra mile and install gcc as well. I use Xcode for GAS, and I just wanted to mess with NASM in SASM so this setup allows for that without installing gcc.

In the SASM preferences and build settings, if you use NASM, you’ll want to change the “Assembly options” line to use “macho” instead of “elf32”, and for starters remove the $MACRO.OBJ$ portion of the “Linking options.”

cdecl versus stdcall: function calls explained

posted Jan 17, 2015, 10:43 AM by Brian Hall   [ updated Aug 11, 2015, 8:03 PM ]

Technical Paper No. 2 has been published. It is entitled cdecl versus stdcall on x86 architecture: But really a discussion of how function calls use registers and stack.

cdecl and stdcall are calling conventions that define the process of a procedure call.
cdecl is based on the C language, while stdcall is used by the Windows API.
This Technical Paper explains and illustrates the difference, but really details how functions use
registers and stack.
If you want to better understand how functions calls are implemented at a low-level, this paper is for you.

Google Scholar Page

posted Jun 30, 2014, 4:33 PM by Brian Hall   [ updated Jun 30, 2014, 4:34 PM ]

I decided to make my Google Scholar Page public since I have several papers and citations listed now. I'm only in the beginning stage of my academic career, so it's just a start. This will at least provide easy access to other authors' papers related to my work.

Teaching 3rd graders programming skills

posted Jun 3, 2014, 1:05 PM by Brian Hall   [ updated Jun 3, 2014, 1:10 PM ]

3rd grade classes from a local elementary school recently visited Champlain's campus to learn basic programming skills from a fellow professor and I. The day was fun, the kids were excited, and everyone learned something!

An Introduction to SOAP and REST

posted Apr 18, 2014, 11:38 AM by Brian Hall   [ updated Apr 18, 2014, 11:43 AM ]

Technical Paper No. 1 has been published. It is entitled An Introduction to Using SOAP and REST Services for Data Retrieval.

This technical paper illustrates the use of SOAP and REST services for Web-based data retrieval. PHP is used to initiate SOAP and REST calls to two data repositories. The data repositories utilized are the National Digital Forecast Database maintained by NOAA’s National Weather Service, and Amazon’s product database. The NWS example provides an introduction to using service-oriented architecture and data retrieval techniques, while the Amazon example demonstrates a more advanced scenario. In both cases, alternative data formatting options are considered. An overview of SOAP and REST literature is also provided. This paper is useful to students and novice developers seeking guidance and to computing educators seeking coursework examples.
TP1 Code Examples (zip)

Solidification of the 2-party political system

posted Oct 5, 2013, 10:22 AM by Brian Hall   [ updated Oct 6, 2013, 7:57 AM ]

Perspective: Go into this reading knowing that my worldview is a balanced mix between post-positivism, social constructivism, and pragmatism. The result is that I do not identify with any single political party, as each has something to offer. The modern party that I probably align with the closest is the Modern Whig Party, but like any party their perspective is incomplete. Anyone want to start a Commingle Party?
If you want to know how the United States ended up with such a solidified two-party political system then you have to go back 100 years in our nation's history. There was one era in which we had a thriving and meaningful four-party system in the U.S. (The Progressive Era, 1890-1920). For example, in the 1912 Presidential election Wilson of the Democratic party won with a little over 40% of the popular vote. About 27% went to T. Roosevelt of the Progressive party, 23% to Taft of the Republican party, and 6% to Debs of the Socialist party. Such numbers have been extinct since. 
Note: The closest a third party has been to Teddy's number was Ross Perot in the 1992 election with about 19% of the popular vote, but with no serious 4th party contenders. I use the popular vote because it's the one that should matter. My personal opinion is that the electoral college is one of the most troubling political artifacts in existence.

Why don't we have such choices today? Why are we realistically limited to Democrat and Republican? You can thank the U.S. Supreme Court mostly, but also the U.S. Government, local governments, and a portion of the general populace during the progressive era. Note: I am not alleging a conspiracy, just that these were players in the scenario.

In 1919, there were a number of Supreme Court cases that turned the First Amendment into nothing more than a scrap of paper. Reasons were political, career oriented, or merely products of the time. Rulings in cases such as Schenck v United States and Debs v United States squelched the 1st Amendment, but perhaps even more importantly crushed the avenue for ideological reasoning and debate.

Socialism, for example, was a thriving politically democratic ideology. That is until the Government used the 1917 Espionage Act (a prophetical predecessor to the Patriot Act), to silence any non-capitalist ideology (speaking of economic as opposed to political systems). The litigation against members of non-traditional parties, while showing a lack of respect for the 1st Amendment, silenced non-traditional ideologies, extinguished political parties, and removed choice. The result for the rest of the 20th Century and into the 21st Century is the two-party political system we have grown to hate.

I write this for several reasons. 1. To get it off my chest. 2. To remind those who read it of the importance of the 1st Amendment. 3. To state the importance of ideological debate, as it is the only way out of the mire of the two-party system. 4. To encourage education of our nation's history. 5. To encourage "the people" to really educate themselves on other ideologies (how many people really understand that socialism is democratic by nature, and that its real beef is with capitalism?). 6. To remind people of the effects that court decisions, particularly those of the U.S. Supreme Court, can have on our lives. 7. AND MOST IMPORTANTLY, to post the pamphlet for which U.S. Citizens were imprisoned in the Schenck v. U.S. case. Read it. It might open your eyes to the absurdity of the Court (and Government) at that time and one reason you have little choice at the polls. The question is...can we change it?

Warning: Watch out for the U.S.Patriot Act, and the Court's (and government) interpretation of it, we've seen what similar circumstances led to in our history...

1-10 of 17